Hello all. I’m about to pull my hair out with the problem I’m having changing scenes. It’s fully explained and shown in this youtube video:
The script I’m using to change scenes (with the bits to try to determine if scenes are unloading or not) looks like this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class QuitToSomewhere : MonoBehaviour {
private void Start()
{
DontDestroyOnLoad(gameObject);
}
public void LoadAScene(string sceneToLoad)
{
int currentScene = SceneManager.GetActiveScene().buildIndex;
SceneManager.LoadScene(sceneToLoad, LoadSceneMode.Single);
SceneManager.UnloadSceneAsync(currentScene);
Debug.Log("Should have changed scenes and unloaded old now. " + SceneManager.sceneCount.ToString());
StartCoroutine(SceneCountCheck());
}
IEnumerator SceneCountCheck()
{
Debug.Log("Current Scene Count: " + SceneManager.sceneCount.ToString());
yield return new WaitForSeconds(1);
StartCoroutine(SceneCountCheck());
}
}
Seriously, any help is appreciated. This is the last step for me to start alpha testing my game, and it’s like running into a brick wall. Google hasn’t been a lot of help either. ![]()