Author Topic: Is there a way to know if NGUI is present at compilation time?  (Read 2430 times)

Pecomac

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Is there a way to know if NGUI is present at compilation time?
« 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!

devomage

  • Sr. Member
  • ****
  • Thank You
  • -Given: 7
  • -Receive: 67
  • Posts: 250
    • View Profile
Re: Is there a way to know if NGUI is present at compilation time?
« Reply #1 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

Pecomac

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Is there a way to know if NGUI is present at compilation time?
« Reply #2 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!