Input.GetKeyDown fires twice before and after SceneManager.LoadScene
Hello unity community,
I am loading a scene by using GetKeyDown from a gameobject that is not destroyed in this process. The wierd thing is, GetKeyDown seems to be true twice. Once while loading the scene and a second time after loaded, although I keep the button being pressed.
Do you know why this is happening?
In my button handling I do this
confirm = Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.Return);
And my Stage Manager does something like this:
if (button.confirm) {
if (onTitle) {
button.confirm = false;
SceneManager.LoadScene(game + "controls");
} else if (onControls) {
currentStage = 1;
currentCheckPoint = 0;
SceneManager.LoadScene(game + "stage" + currentStage + "" + currentCheckPoint);
}
}
Sorry for the bad mark down! I will fix it soon
Your answer
Follow this Question
Related Questions
Player exits don't destroy on load because of moving platform 0 Answers
multiple of same objects from DontDesroyOnLoad 0 Answers
Unity Reload Scene - References missing / objects inactive upon reload 0 Answers
How to keep the light on/off after changing scenes? 1 Answer
dontDestroyOnLoad doesn't work as expected with scene navigation 0 Answers