Hi,
I am trying to move my player/gameobject to the next scene being loaded.
public void loadLevelasync(int id, GameObject player)
{
StartCoroutine(fadeIn(loadingCanvas, 2.0f));
Scene nextLevel = SceneManager.GetSceneAt(id);
SceneManager.MoveGameObjectToScene(player, nextLevel);
StartCoroutine(loadScene(id));
}
IEnumerator loadScene(int id)
{
AsyncOperation async = SceneManager.LoadSceneAsync(id);
while (!async.isDone)
{
loadingBar.value = async.progress / 0.9f;
yield return null;
}
}
I can load the scene async perfectly, but my gameobject is not in the next loaded scene hierarchy and the lighting is not fully done.
How exactly does MoveGameObjectToScene work?
Thanks,
Austin