I’m trying to load the next scene once a certain amount of points is collected … the next scene is loaded as a dead scene with no functions and on the hierarchy (the scene is loading ) and (the scene not loaded) are blinking , this is my code :
private void Start()
{
Scene scene = SceneManager.GetActiveScene();
Debug.Log("Active Scene is '" + scene.name + "'.");
nextSceneToLoad = SceneManager.GetActiveScene().buildIndex + 1;
highScore = PlayerPrefs.GetInt(PlayerPrefManager.HIGH_SCORE);
PlayerPrefs.SetInt(PlayerPrefManager.SCORE, 0);
}
private void Awake()
{
{
SetUpSingleton();
}
}
private void SetUpSingleton()
{
int numberGameSessions = FindObjectsOfType<GameSession>().Length;
if (numberGameSessions > 1)
{
Destroy(gameObject);
}
else
{
DontDestroyOnLoad(gameObject);
}
}
private void Update()
{
if (score > highScore)
{
highScore = score;
PlayerPrefs.SetInt(PlayerPrefManager.HIGH_SCORE, highScore);
}
if(score==levelScore)
{
LoadNextScene();
}
PlayerPrefs.SetInt(PlayerPrefManager.SCORE, score)
}
public int GetScore()
{
return score;
}
public void AddPoints(int amount)
{
score += amount;
}
public void LoadNextScene()
{
SceneManager.LoadScene(nextSceneToLoad);
}
}