Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: devomage on June 11, 2017, 02:30:57 AM

Title: Conditional
Post by: devomage on June 11, 2017, 02:30:57 AM
I have a couple mono files where I'd like to use TNET if the user has TNET installed.  I cant seem to find an appropriate conditional within TNET.  What is the best way to deal with this?

Maybe like this?

  1. #if TNET_EXISTS
  2.    //TNET code
  3. #else
  4.    //code that doesnt require TNET
  5. #endif


Title: Re: Conditional
Post by: ArenMook on June 18, 2017, 07:38:12 PM
Pretty sure there is no way to have a package-specific #define, so you have to have your own project-specified #define set.

Keep in mind you don't need it if you use reflection instead. Just look at how I handled runtime code execution or look at TNet.TypeExtensions. You can use Invoke to call a method by its name same way Unity can do it with its MonoBehaviours, except this is much faster and works with everything.