I
I
iproyt2021-11-12 19:55:39
Unity
iproyt, 2021-11-12 19:55:39

How to restart a level by pressing R on the keyboard?

How to restart a level by pressing R on the keyboard in unity in c# unity in a 3d game

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
KraGen.Developer, 2021-11-12
@iproyt

easy

using UnityEngine.SceneManagement;

if (Input.GetKeyDown("r")){
       SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question