Okay... Player.PlayerObj = GameObject.Find("Player");
Since GameObject.Find() will not return an error if no object was found, this is not causing the error.
Since assigning any variable, even a null one, to null will not cause an error, .PlayerObj is not causing the error.
The only thing that could be going wrong is trying to do Player.PlayerObj. In other words, the variable Player is null! To double check this, insert Debug.Log("Player is null? " + ((Player == null)?"YES" : "NO")); directly before "Player.PlayerObj =...". Check your debug console for the result.
EDIT: I must have misread your code or something lol. Of COURSE Player is null, you never initialize it.
player = new PlayerVariables(); needs to be put in your Start function :) (Thanks, syclamoth!)
↧