Tasharen Entertainment Forum

Support => Misc Archive => Topic started by: Pecomac on September 02, 2015, 05:32:24 PM

Title: Is there a way to know if NGUI is present at compilation time?
Post by: Pecomac on September 02, 2015, 05:32:24 PM
I'm developing an architecture to build games. In order to isolate complexities I plan to wrap a basic version of NGUI and Unity GUI. In order for the compiled code to work with or without NGUI I would need to know if there is a kind of preprocessor or whatever I could use to know if NGUI is present in the customer's computer. Is such a way to detect NGUI?

Thx in advance!
Title: Re: Is there a way to know if NGUI is present at compilation time?
Post by: devomage on September 03, 2015, 05:20:06 AM
assuming that checking the path isnt an option...  use keyword "reflection" with your searches.

  1. Debug.Log(Type.GetType("NGUIToolz"));
  2. Debug.Log(Type.GetType("NGUITools"));
  3.  

http://answers.unity3d.com/questions/587982/check-if-class-exists-and-invoke-its-method.html (http://answers.unity3d.com/questions/587982/check-if-class-exists-and-invoke-its-method.html)
Title: Re: Is there a way to know if NGUI is present at compilation time?
Post by: Pecomac on September 03, 2015, 03:09:28 PM
Thx a lot for the idea. I was Looking for some kind of preprocessor directive but the reallity is that probably it's more about execution time. I'll try your idea and I anticĂ­pate it may work well for me.
BR and thx for your prompt response!