Hi there! I am kinda new at this but i have a script here. But i always get a NullReferenceException Everytime i start up the Game :(. I want my Script to Access Other GameObject Variable.
Any Ideas to fix it :)?
Answer by Fattie
Oct 14, 2012 at 12:13 PM
Answer by Montraydavis
Oct 14, 2012 at 02:15 PM
var OtherComponent : Component ;
OtherComponent = gameObject.GetComponent ( ScriptName ) ;
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
12 People are following this question.
Null reference exception on GameObject
Null Reference at (wrapper managed-to-native)
Null Reference exception error
Access main camera from different GameObject script