LoadLevel() resets all input to 0! Disastrous!


I’ve built this cool and quite extensive 2D action platformer, like Super Meat Boy. Whenever the player die, I reload the scene to automatically reset all the gameMechanics.

However, against my will, all player input is set to 0.

If the player was running right, holding leftctrl for running, when the scene is reloaded he should automatically start running again.

But what happens is that he stands still, and you have to lift your fingers off the buttons and then press them again to make it register.

This is so cumbersome, and really ruins the speed and pace of the game for me.

float h = Input.GetAxisRaw("Horizontal");
control = Input.GetKey (KeyCode.LeftControl);

Are there any workarounds to this date? To manually reset everything in the scene is such an ultra cumbersome solution.

Can you somehow cash the inputs and carry them over to the next scene? I have a singleton gameState object, that can store info if someone knows how to solve this issue!

Cheers, and I hope this post will help other people with the same problem :slight_smile:

I don’t think it can be done, not unless you rewrite the input system.

You could cheat and have a message that says “press space to start”. That will force the user to take their fingers off the keys and start again.

Alternatively you could reset the level without reloading the scene.