1
NGUI 3 Support / Re: Sprites do not render in standalone builds after scene switch (works in editor)
« on: February 11, 2016, 10:39:01 PM »
Ok. I seem to have "fixed" that error. The problem had something to do with the scene manager cleaning up draw calls during scene unloading.
Here's my working code:
Here's my working code:
- public IEnumerator LoadNextScene()
- {
- // load next scene
- SceneManager.LoadScene(nextScene.ToString(), LoadSceneMode.Additive);
- // wait one frame for scene to load
- yield return null;
- // set the active scene as soon as it's ready
- var scene = SceneManager.GetSceneByName(nextScene.ToString());
- SceneManager.SetActiveScene(scene);
- // move existing draw calls to new active scene
- foreach(var dc in UIDrawCall.activeList)
- {
- SceneManager.MoveGameObjectToScene(dc.gameObject, scene);
- }
- foreach (var dc in UIDrawCall.inactiveList)
- {
- SceneManager.MoveGameObjectToScene(dc.gameObject, scene);
- }
- // unload previous scene
- SceneManager.UnloadScene(previousScene.ToString());
- }

