I currently have three scenes in my game. The main menu, level select, and the first level.
Returning to the main menu works fine every time from the level select. However, it doesn’t work from the first level. If I start the game at the first level though, the loading works.
I am using the exact same script to load the main menu from both scenes.
I should also mention that when reloading the first level from within the first level using this function it works perfect. It’s only when I want to load the main menu.
Sorry for how obscure this question is but I have absolutely no clue what could possibly be causing this to happen.
public void LoadLevel(string levelName)
{
sounds = FindObjectsOfType<AudioSource>();
TimeWarpEffect.StartWarp(0f, loadTime, sounds, iTween.EaseType.easeOutSine);
CRTEffect.AnimateScanlines(loadTime, 0f, iTween.EaseType.easeOutSine);
StartCoroutine(LoadLevelCoroutine(levelName));
}
private IEnumerator LoadLevelCoroutine(string levelName)
{
AsyncOperation async = Application.LoadLevelAsync(levelName);
async.allowSceneActivation = false;
yield return StartCoroutine(Extensions.WaitForRealSeconds(loadTime - (loadTime * 0.05f)));
async.allowSceneActivation = true;
}