|
I dont want to put detection for each key so can i detect if ANY key has been pressed down?
(comments are locked)
|
|
You could check for keyDown events in OnGUI: EventType, Event, EventType.KeyDown, event.type So, I guess the code would look something like this (not tested):
UnityScript / JavaScript would look almost the same - just replace "public void" with "function" and "private void" with "function" and it should compile in JavaScript/UnityScript ;-) is the keypressedeventhandler a preset function or you just named it that way?
Jul 27 '10 at 10:34 AM
yeoldesnake 1
Well it worked well , my achievement system thanks you :D
Jul 27 '10 at 11:28 AM
yeoldesnake 1
I just named it that way. Actually, you don't even have to put that into an own method but usually, that'll make your code more readable.
Jul 28 '10 at 06:34 AM
jashan
(comments are locked)
|
|
NOTE: In JavaScript, the proper syntax is:
(comments are locked)
|
|
You can also use I was about to say the exact same, +1 Since it's Input you are doing, check the Input class in the scripting documentation Unity 3D has placed on it's website. That should be made common practice for anyone that ever looks at code. Just look up the class docs
Oct 29 '10 at 09:18 AM
Proclyon
Input.AnyKeyDown() was not present when i had asked the question.
Aug 19 '11 at 02:20 PM
yeoldesnake 1
(comments are locked)
|
