Trouble with a script...

Hello all,

i’m trying to make the same project as this vídeo: http://www.youtube.com/watch?v=o_wQ8Kw6A_s

but i’ have the error:

“NullReferenceException: Object reference not set to an instance of an object
MenuManager.Menu_Main () (at Assets/Scripts/MenuManager.cs:40)
MenuManager.OnGUI () (at Assets/Scripts/MenuManager.cs:20)”

My files:
MultiplayerManager.cs

and MenuManager.cs:

Its the way you use the static instance thing.

MultiplayerManager.instance.PlayerName

This might help you understand why: http://msdn.microsoft.com/en-us/library/aa645629(v=vs.71).aspx

You cannot reach the PlayerName in that manner.
In your case i think a singleton pattern for your multiplayer instance would solve what you are trying to do.

Change your start function to awake in your MultiplayerManager.cs

thanks for the help… i’m totally newbie here, and just want to do this menu for a experimental game…
DexRobinson, i’ve tryed to substitute “Start” for “Awake”, but no results…
BFGames, i don’t know how to put it on a single pattern, and have no idea on the difference between static and instance members… could you just put the line in the correct way for me? thanks!

I can’t understand… i’ve made everyting equal to the video (http://www.youtube.com/watch?v=o_wQ8Kw6A_s) and it works in the video but doesn’t work for me… =(

In MultiplayerManager void start() should be void Start() (upper case S)

Thank you very much KelsoMRK! Solved the question!