- Home /
Communication between objects and other scripts, variables and properties
hi there out in the UNITY3D universe, is there a way to read varialbes of a script from an other gameObject? I tryed with a static var, but its do not work. how can I solve this problem?
greetings from Berlin ThisIsTom
Answer by duck · Jan 08, 2010 at 10:48 AM
Yes there is, in fact there are many many ways. Start reading about it at these two manual pages:
Also see this answer which gives more detail about creating "dragged references":
How can I access other scripts and their functions?
Static variables do have their uses, but they are generally not the best thing to use for general-purpose communication between gameObject scripts. Until you learn more about what static variables are particularly useful for, I would recommend to avoid using them, and instead learn the methods discussed in those manual pages.
remember to click the 'accept' tick icon if the answer solved your problem.
It seems the two links have since gone. Is there another instance one could reference?
Edit : yes they do indeed seem to be working again! Random weirdness.
The links works perfect for me. duck, I would thumb your answer up, but I'm not allowed :)
Your answer
Follow this Question
Related Questions
Accessing Variables within another gameobject's script 2 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Public variable in script different for every game object. 1 Answer
Change a Script Var of an Instantiated Object 1 Answer
How to save a gameObjects on a prefab and variables with a script? 1 Answer