Home > Mobile >  Player stops moving when next level comes unity2d
Player stops moving when next level comes unity2d

Time:04-13

Hi I am making an adventure parkour game as a project and i coded in the next level functionality (so you can switch levels when you're finished one) but the problem with that is my player just suddenly decides it wants to be lazy and not move at all

i don't really know what to try but here is my moving code:

horizontalInput = Input.GetAxis("Horizontal");

    transform.Translate(Vector3.right * speed * horizontalInput * Time.fixedDeltaTime);

and my switching level code:

public void GoToNextLevel() {
    SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex   1);
}

i would appreciate it if you can help

CodePudding user response:

The reason it didn't work is because in my code it says:

Time.timeScale = 0;

That means pause the game. So i didn't unpause the game and the player couldn't move. Sorry for calling you lazy player - answer by Smaika

  • Related