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?
#if TNET_EXISTS
//TNET code
#else
//code that doesnt require TNET
#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.