I’m using this SceneManager.LoadScene(SceneManager.GetActiveScene ().buildIndex);
for scene reload and after reload this script stopped working
void Update (){
if (isDead == false) {
CheckUserInput ();
}
}
void CheckUserInput ()
{
if (Input.GetKeyDown (KeyCode.A)) {
transform.position += new Vector3 (-1, 0, 0);
}
if (Input.GetKeyDown (KeyCode.D)) {
transform.position += new Vector3 (1, 0, 0);
}
if (Input.GetKeyDown (KeyCode.W)) {
transform.position += new Vector3 (0, 1, 0);
}
if (Input.GetKeyDown (KeyCode.S)) {
transform.position += new Vector3 (0, -1, 0);
}
if (Mathf.Round(Time.time * 3) - speed == moveSpeed) {
transform.position += new Vector3 (0, 1, 0);
speed = Mathf.Round(Time.time * 3); ///////////AFTER scene reload time "stopped working"
Controls (WASD) still work correctly.