- Home /
Sound Triggered By Keyboard
Hya guys! Ok so I pretty much don't know anything about coding, so answer like you talking to an idiot. :) Basically, I want a certain sound to play while the "Forward"/"W" key is being pressed, and a different sound to play while the "Spacebar" key is being pressed. Please try to make your answer as simple as possible. (like talking to an idiot :P)
Answer by liszto · Oct 29, 2012 at 11:30 PM
If you want search a little by yourself I just gonna give you some tips : http://docs.unity3d.com/Documentation/ScriptReference/Input.GetKeyDown.html
You must use this function for the key binding
and this one for the audio play : http://docs.unity3d.com/Documentation/ScriptReference/AudioSource.PlayOneShot.html
then mix that with an if( key binding function ) { audio function } and I think you obtain what you want.
I f you just want an answer I can give it to you too ;)
Your answer
Follow this Question
Related Questions
Add Audio Source to a Prefab 2 Answers
How can i switch on music on a Radio (object)? 3 Answers
One sound gets quieter when other is played? 1 Answer
How Do I Get This To Play Sound? 0 Answers
GameObject Rotation with KeyDown applied only for a frame. 1 Answer