So I was going to use the holding of a Ctrl key for crouching of my game character, while moving it with typical WASD - nothing too fancy, quite usual key mappings.
However, it seems to be impossible in editor’s game mode, because Ctrl+A, Ctrl+S and Ctrl+D are not detected by Event.keyCode and still act as editor hotkeys, while doing nothing useful at all except for Ctrl+S which stops the game to show me the error “You must exit play mode to save the scene!”. Well what’s the point of even detecting these hotkeys in game mode?
Is there any workaround for making Ctrl useable in game mode? I obviously can use some different key, but I really used to Ctrl for crouching and there is no adequate reason to change my habits.
I’ve just run into the same problems: My game’s control scheme has cases where “ctrl” and “s” are pressed simultaneously, which the unity editor interprets as the saving shortcut.
Is there a way to disable editor hotkeys while in game mode, or another workaround for this issue? Surely wasd + ctrl isn’t such an unusual control scheme, that Mr. F and I are the only ones who ran into it, right?
Same issue as Zogg; I have an in-game level editor where I’ve setup the CTRL-Z hotkey to undo the last action, which of course is conflicting with the editor.
Having two sets of keys is not an answer at all. A game with a complex control scheme must be tested with a specific set of keys in mind to see if it’s convenient to access and use them. It’s rather critical for UX design.
I don’t see any other way now but to build the project each time I need to see if the control scheme is ok. But UX issues generally require iterative approach, so it means a lot of builds, and this is just a crazy waste of time because of an issue that shouldn’t be incredibly hard to resolve on Unity’s side.
So, please, add the “If (Application.isEditor)” on the engine side.
This allows us to disable our custom hotkeys in our code - but not Unity’s default hotkeys! What if i want Ctrl-S to stop being “Save Scene” and start being “Do Something In-game” during play mode inside the editor? We do not want to disable our custom hotkeys, but Unity’s default ones!
More than that, Application.isEditor is always true in editor, play mode or not. We could also use Application.isPlaying, but again, it works only for our own code and thus - our own hotkeys. We still need a real solution here.
I agree it’d be great to disable shortcuts mid game scene. A temporary work around for me was just testing my crouching functionality with a Build and Run and it worked as expected though this is only a short term solution.
Bump. Surely no one puts up with this? It seems like a major oversight. How on earth are there so many Unity-made games with such a critical flaw in the testing process?