I have made quite a few JS scripts in Unity, like car and AI car scripts, but I have always dodged this problem.
I declare a public var 'firstVar' in one script, and attach it to a gameobject 'firstGameObject'.
I have another script on another object, and I want to say, "secondVar = firstVar from firstGameObject".
How is that written? (In JavaScript)
↧