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 post good questions and use the site effectively we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
12 People are following this question.
Null reference exception on GameObject
I am getting the error of NullReferenceException?
NullReferenceException: object not in inspector?
Null Reference at (wrapper managed-to-native)
Null reference when calling a method from another script