i have gameobject 2 scripts attached it. want name of second script first script. remember:
- i don't want direct assignment (i know well).
- first script name can not hard coded causes change.
consequently, want script name , set script property ?
i not sure mean "i want name of second script first script", take @ this:
i have scripts attached main camera gameobject.
here code of test.cs:
using unityengine; using system.collections; public class test : monobehaviour { void start() { monobehaviour[] scripts = this.getcomponents<monobehaviour> (); foreach (monobehaviour mb in scripts) { debug.log (mb.gettype ().name); } } }
on start prints names of monobehaviour
s on it:
Comments
Post a Comment