Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
I take this is a Unity game then? Personally I find that disgraceful that the Unity engine does not offer any (legal) method of rebinding the "Buttons" in-game as does GameMaker (with a single function that also compares if the key is in use), Unreal Engine (which has all that date stored in an ini that is accessible in engine) or any other self respecting game engine, even as it is clearly possible to give the player an opportunity to change these variables that stand for keys in A FRIGGING LAUNCHER.
The issue with the launcher is that first of all, it's not accessible in-game (duh), but it also expects you to adjust your controls prior knowing their usefulness (for example, I usually default "Use" in "E", but in games like Amnesia that would be awkward, and in some games the "Use" ends up referring to a use of inventory item for example). Not only that, but when you find out that the default controls are completely alien to you, you can't just open a menu and change them, no, you have to exit the game.
That is why it's common practice in Unity games to "hardcode" controls to KeyCode variables. Yes, this requires parsing either the PlayerPrefs, or a text file in form of KeyCode:
KeyCode thisKeyCode = (KeyCode) System.Enum.Parse(typeof(KeyCode), "Whatever");
Source: http://answers.unity3d.com/questions/653106/string-to-keycode.html
And this also requires that you read an event that has KeyCode in OnGUI () function:
if (Event.current.current.keyCode != null || Event.current.modifiers != null){}
source: http://docs.unity3d.com/ScriptReference/Event.html
And couple of additional hints: Shift is a modifier, so it might be harder to catch, and it's suggested that while you're rebinding the key, you disable the menu inputs until the rebinding is over and menu selection key is NOT pressed down (basically to avoid looping in rebinding if the target key is same as the menu selection key).
[EDIT1]: Added a link to Events, and re-evaluated the if statement presented (it's been a while I've done that, but I believe it should work)
[EDIT2]: Felt it to be worth notice, but this MIGHT seem like a lots of work BUT assuming you have managed your scripts in order so it's easy to find where all the controls are, it shouldn't be but maybe an evening worth of "job". Also, since menus are quite the "non-game", I suggest hardcoding them to WASD, cursor keys and controller axis, as well as having all, Space, Enter, Tab and Ctrl as menu select buttons. Basically this can be done with the axis, and fire1, and eventually getting rid of the splash (providing that resolution and graphics setup are modifiable in-game).