Hi
I want to make an instance of a script(Javascript) and access the variables and functions. (Scriptname = TrashCan_Script.js)
Here is my code which is in Script 2.
static public var trashCan_animate : TrashCan_Script.js ;
How do I access the contents ?
Thanks
Im no unity-script expert but in C# you will have your gameobject, either defined from the editor, or by using GameObject.Find(String:Name); and then use GetComponentType:Component(); If you only use it once in a while stick with GameObject.Find(String:Name).GetComponentType:Component().Method(); but if you use the script every update/frame make sure to have a variable.
For further details check the documentation: http://docs.unity3d.com/Documentation/ScriptReference/GameObject.GetComponent.html
For free C# guide I’m making check this thread: http://forum.unity3d.com/threads/189833-C-Guides-Tutorials-for-everyone!
You can’t use static variables if you want it to be an instance. This question has been asked and answered about 50 million times, so please do a search first. Go to Google and type “Unity access other script” or similar.
–Eric