so i need to get variable form other script and use it, i cant find any info about it. i am using C#. help?
u can call a varriable from another script with 2 ways :
1st , create a "static var my_var; " in “your_script” then u can call it from anywhere by the scripts name following by the varriables name
your_script.my_var ;
2nd , call using “GetComponent” function :
GameObject.Find(“my_object_that_containe_the_script”).GetComponent(“name_of_the_script”).my_varriable_name ;
Remember you are going to have to typecast, as you are using C#
GetComponent(“ScriptName”) as ScriptType
will do the conversion for you. Remember that C# in Unity3 does NOT have dynamic typing, which is only a recent addition to C#.
In C#, use the generic version: GetComponent() as it provides compile-time safety without a run-time cast.