- Home /
Question by
Luis 2 · Nov 25, 2010 at 02:22 AM ·
javascriptvariablesglobal
Global variables help
I can't figure this out.
I've got a game object with a script A. It has a global variable which a script B on a child game object uses.
I can pass the value fine between parent and child, but I want to create another instance of the game object without the global variable value genrated from A crossing over to every instance of B, just the one where it's generated.
Is there a way to work around this?
Comment
Answer by Luis 2 · Nov 25, 2010 at 02:57 AM
I've figured a way. Exposing the parent transform on the children* and changing the variables from static back to public seems to have done the trick so far.
- As explained in the latter part of point one here: http://unity3d.com/support/documentation/ScriptReference/index.Accessing_Other_Game_Objects.html
I hope this is useful to someone down the way. :)
Yeah, calling static variables "global" isn't really correct ter$$anonymous$$ology.