Closed lukaswagner closed 5 years ago
It seems all the start/awake functions of the loaded scene are only called after the scene is already set as loaded.
Test code:
public class Loader : MonoBehaviour
{
private AsyncOperation _asyncOperation;
void Awake()
{
Debug.Log("Loader.Awake()");
}
void OnEnable()
{
Debug.Log("Loader.OnEnable()");
}
void Start ()
{
Debug.Log("Loader.Start()");
_asyncOperation = SceneManager.LoadSceneAsync("ContentScene");
}
void Update ()
{
Debug.Log("Loading progress: " + _asyncOperation.progress);
}
}
public class Content : MonoBehaviour {
void Awake()
{
Debug.Log("Content.Awake()");
}
void OnEnable()
{
Debug.Log("Content.OnEnable()");
}
void Start ()
{
Debug.Log("Content.Start()");
Thread.Sleep(1000);
Debug.Log("Content.Start() finished");
}
}
The order of logs is as follows:
make sure if start and/or awake are called before the scene loads. this is necessary to properly implement #23