Hi,
Consider the following:
void Start () {
StartCoroutine (this.LoadLevelInBackground());
}
private IEnumerator LoadLevelInBackground() {
yield return Application.LoadLevelAdditiveAsync ("SomeLevel");
this.LoadReady();
}
private void LoadReady() {
Debug.Log("Destroying current menu canvas...");
Destroy(GameObject.FindWithTag("MenuCanvas"));
Debug.Log("Activating level contents...");
foreach (GameObject gameObject in GameObject.FindGameObjectsWithTag("LevelContents")) {
Debug.Log("Activating " + gameObject);
gameObject.SetActive(true);
}
}
The objects with the tag “LevelContents” come from the SomeLevel scene that is additively loaded. Unfortunately, the GameObject.FindGameObjectsWithTag always returns an empty array even though I can see the objects in the Inspector already loaded into the current scene.
Is there a way to make this work?
Thanks in advance.