- Home /
 
               Question by 
               pokeyoshi3 · Dec 30, 2012 at 02:21 PM · 
                multiplayerdontdestroyonloadlevelload  
              
 
              DontDestroyOnLoad resets my variables
heres the problem i have:
 //currentlevel = 0
 var someplayername = "player";
 var somematchname = "MPGame";
 function Start(){
     DontDestroyOnLoad(this);
 }
 function CreateServer(){
     //Creating server
     somematchname = enteredmatchname;
 }
 // now loading multiplayer things and so on
 // loading level 1
 // i leave the multiplayer game
 function OnDisconnectFromServer(){
      var somematchname = "MPGame";
      Application.LoadLevel(0);
 }
why does it reset the playername?
               Comment
              
 
               
              Answer by Winterspree · Jan 15, 2013 at 03:37 PM
The DontDestroyOnLoad() function should be called in the Awake() function and not Start(). And try using this.gameObject as an argument instead of just this :)
ok i already fixed it: i forgot to put out the application.loadlevel(Application.LoadedLevel); function out of the connecion function..
Your answer
 
 
             Follow this Question
Related Questions
Destroying DontDestroyOnLoad 1 Answer
Networking 0 Answers
Unity networking tutorial? 6 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                