So I working on a Multiplayer game. where the user selects environment Dessert/Forest and has a match
If no player found then the player will have a match with AI
Only in the case of match with realplayer sometimes my environment scene is getting loaded twice, which is causing so many other things to break.
I am using this coroutine to load the scene. and I have checked this isn't calling 2 times.
IEnumerator ProgressBar()
{
#if UNITY_EDITOR
yield return new WaitForSeconds(0.5f);
#endif
Debug.Log("inside progress bar");
Time.timeScale = 1;
async = SceneManager.LoadSceneAsync(loadScene);
async.allowSceneActivation = false;
while (!async.isDone)
{
if (async.progress >= 0.9f)
{
break;
}
yield return null;
}
yield return new WaitForSeconds(0.5f);
text3.color = new Color32(255, 255, 255, 255);
yield return new WaitForSeconds(0.5f);
text2.color = new Color32(255, 255, 255, 255);
yield return new WaitForSeconds(0.5f);
text1.color = new Color32(255, 255, 255, 255);
yield return new WaitForSeconds(0.5f);
text3.gameObject.SetActive(false);
text2.gameObject.SetActive(false);
text1.gameObject.SetActive(false);
textGo.gameObject.SetActive(true);
yield return new WaitForSeconds(0.5f);
async.allowSceneActivation = true;
yield return async;
}