|
I have a script which needs to do two things: (1) Detect the presence on another script in my project (2) If the other script exists, call a function in it I need to do this to make two libraries I am releasing seperatley work with each other if they are both present in the same Unity project. What would be the best way to accomplish this? So far I am playing with reflection, obscure OO ideas, eval inside a try/catch block, script 2 storing a function reference for itself inside a static variable of script 1, etc... I have a feeling I am, as usual, over thinking this.
(comments are locked)
|
|
Yep! I was overthinking it :) gameObject.AddComponent ("OtherLibrary"); worked perfectly. Thanks for your ideas! Nice. I bet my silly test would have broken if tested further... Would probably throw an exception if SuperFunkyClass was NOT defined. Nice work!
Dec 18 '11 at 08:53 AM
jahroy
(comments are locked)
|
|
Well.... I've never done anything like that, but since you asked, I tried this: It seems to do what I believe you describe.
(comments are locked)
|
