Quantcast
Channel: Questions in topic: "dontdestroyonload"
Viewing all articles
Browse latest Browse all 416

c# Static class dont destroy on load not working

$
0
0
void Start () { DontDestroyOnLoad (this); this.hideFlags = HideFlags.DontSave; // IMPORT SAVES if(parser.DoesExist(IniFiles.CONTROLS)){ LoadControls(); } else { CreateControlFile(); } if(parser.DoesExist(IniFiles.GRAPHICS)){ LoadGraphics(); } else { CreateGraphicsFile(); } // openHB(); } // Load game public static void LoadGame() { /* skipping */ Debug.Log("starting"); Timer.Instance.StartCoroutine(LoadGame(int.Parse(parser.Get("level")), pos, rot)); } private static void OnLevelWasLoaded(int iLevel) { levelLoaded = true; } private static IEnumerator LoadGame(int level, Vector3 pos, Quaternion rot) { Debug.Log("Loading Level"); Application.LoadLevel(level); while (!levelLoaded) yield return 1; levelLoaded = false; Debug.Log("level was Loaded"); GameObject p = GameObject.FindGameObjectWithTag("Player"); p.transform.position = pos; p.transform.rotation = rot; } I have a global game manager script, In the snippet above I have don't destroy on load and the hideflag method but neither seem to work when I go to load the level in the bottom half.

Viewing all articles
Browse latest Browse all 416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>