Timeline for InputManager in Unity
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 18, 2013 at 17:21 | comment | added | Scar4mouche6 | ok, I edited my post I hope now is clearer | |
| Apr 18, 2013 at 16:50 | comment | added | Heisenbug | well..eventually try to explain exactly what you want to achieve. Usually in games you change key bindings through a config menu, not during the gameplay. | |
| Apr 18, 2013 at 16:34 | comment | added | Scar4mouche6 | I dont know any other way of detect which key is pressed since the only information available for this purpose is Input.inputString (and as i said below thats just for ascii text and no special keys are included) or maybe I could use event.current and I look for a keyboard event so I can see the keycode...but again, the issue here is any keyboard event call OnGUI()..i dont get what keyboard event has to do with GUI... Should I use the OnGUI() anyway or have i got any alternative? | |
| Apr 18, 2013 at 16:34 | comment | added | Scar4mouche6 | no no, that wasnt what i meant, i was editing my comment while you were writting yours. I mean, when I want to remap a key ingame, I must wait for the new key for that specific action to be pressed and then update that key binding, but, how do i know what key did I just pressed? should i just make if statements with the whole keyboard? :S (i dont mean the keys already mapped I mean to detect a random key to be mapped next) | |
| Apr 18, 2013 at 16:22 | comment | added | Heisenbug | OnGUI isn't called every frame. Btw I don't think you will have too much keys to check. And in any case, even using Input.GetAxis you need to explicitely check for every possible input at every frame. | |
| Apr 18, 2013 at 16:13 | comment | added | Heisenbug | you have to check all possible keys. Consider that you don't have to check always all the keys of the keyboard,but just the active ones. Keep a list of all binded keys in a given configuration and iterate through them. | |
| Apr 18, 2013 at 16:09 | comment | added | Scar4mouche6 | thanks for the answer, what you say was the idea i had in mind but again there is a problem with that, related with what you said about you dont have any list of pressed keys. It seems the only way yoy can acces the pressed keys is via Event.keycode and you can only do that in OnGUI(). If i want to remap a key in game i need to acces this event.keycode otherwise i wouldnt be able to detect what the new key for that action will be (unless i do one if statement for each key :S) | |
| Apr 18, 2013 at 15:53 | history | edited | Heisenbug | CC BY-SA 3.0 | added 82 characters in body |
| Apr 18, 2013 at 15:47 | history | answered | Heisenbug | CC BY-SA 3.0 |