I can’t find a way to change the Escape key binding in Unity - so when in play mode, hitting escape shows/releases the mouse cursor - which is great, but I want to use the escape key in my game to exit a menu, which does the exact opposite. So its difficult to debug that since Unity is always forcing a show cursor.
Escape not listed anywhere in key bindings and that key shows greyed out in key bindings - wish I could just change that key mapping to something else so I could use Escape in game.
Any way around this?
Hi @dhenion65 ,
What you can do is to use precompilation defines in order to use a different key while you’re in PlayMode for testing-only purposes while developing.
Something like this:
#if UNITY_EDITOR
if (Input.GetKey(KeyCode.Q))
#else
if (Input.GetKey(KeyCode.Escape))
#endif
{
// Your code here
}
Good luck with it!
1 Like
And it’s worth mentioning that this will only be the case in the Editor. In a build of your game, pressing escape won’t show the mouse cursor unless you code it to do so.
1 Like
Thank you @DiegoDePalacio_1 - for now I’ve been manually changing the GetKey code while in editor then changing it back for a build - so this will help that for sure.
And yes @dgoyette I realize that, just a pain that I can’t debug that key in the editor playmode.
1 Like