How can I assign a script to a variable?
For example, I have a controls.js, which is attached to a game object.
I also have an other script, manager.js
In manager.js how can I do the follwing:
var controlScript : ??;
var object : GameObject;
controlScript = object.GetComponent("controls");
Thanks for your time!
Well, in UnityScript, the filename is also the typename!
So, if you have a file called controls.js, you can define a variable of that type with
var controlScript : controls;
It’s similar to how you are using GetComponent, later- the typename in quotes that you specified in the string paramater is the same as the one you would use when declaring the variable.