- Home /
NullReferenceException: Object reference not set to an instance of an object
Does anyone see what I'm doing wrong here? I've created a class which I try to call variables from using a different javascript.
GameInfo.js
static class Player {
static var loggedIn : boolean;
static var username : String;
static var health : Int;
}
MainMenu.js
function Start(){
GameInfo.Player.loggedIn = false;
}
Error
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.SetProperty (System.Object target, System.String name, System.Object value) MainMenu+$Start$172+$.MoveNext () (at Assets/Project/Scripts/Network/MainMenu.js:107)NullReferenceException: Object reference not set to an instance of an object
Answer by fafase · May 11, 2013 at 06:00 PM
Your player class is static, you use it without the GameInfo thing on the front despite the fact it is stored in the GameInfo.js file.
Just
Player.loggedIn = false;
Your answer
Follow this Question
Related Questions
varible type class not working if not declared public 2 Answers
Pushing GameObject into JS Array returns NullReferenceException 1 Answer
How to add javascript classes? 1 Answer
Construct class with enum parameter (javascript) 0 Answers
Is it possible to create a script dinamic like animation>size controling the Elements variables? 1 Answer