good morning all i got a problem :- when i “complete level” unity should load next level but it doesnt it gives random things it may load the main menu or just do nothing it shows the continue button to next level but it doesnt load it , enemies keep moving and i am at goal i can move and do everything like if i didnt finish the level
it happened when i tried to add something to my code that reset timer , i deleted that reset code but the problem still exists ,now i dont even know what happened, i had a problem like that but idk how i fixed it i will give u the code i hope u help me
public int currentLevel = 0;
void Start()
{
if (PlayerPrefs.GetInt("Level Completed") >2)
{
currentLevel = PlayerPrefs.GetInt("Level Completed");
}
else
{
currentLevel =0;
}
}
public void LoadNextLevel()
{
Time.timeScale = 1f;
if (currentLevel <= 6)
{
currentLevel += 1;
print(currentLevel);
SaveGame();
Application.LoadLevel(currentLevel);
}
else
{
print("You Win!");
}
}
public void SaveGame()
{
PlayerPrefs.SetInt("Level Completed", currentLevel);
PlayerPrefs.SetInt("Level " + currentLevel.ToString() + " score", currentScore);
}