i have a main script called main.js attached to a gameobject named main. I want to set variables in main from another script.
another script code:
var mainscript:main;
mainscript=GameObject.Find(“main”).GetComponent(“main”);
mainscript.somevariable=2;
I Update main.js a lot and change the name to main_1, main_2 to keep track of the versions I’m on. Is there a way to refer to main by the component type or number so I don’t have to keep changing the name everytime?
Thanks,