- Home /
Question by
BloodyNyash · Feb 15, 2014 at 07:58 AM ·
key pressedpublic staticpressingpublic strings
Play sound by pressing button
I need help. This is script: using UnityEngine; using System.Collections;
public class FS : MonoBehaviour {
public AudioClip MyAudio;
// Use this for initialization
void Start () {
if(Input.GetKeyDown(KeyCode.W)) {
audio.PlayOneShot(MyAudio);
}
}
} Whats wrong??
Comment
Your answer
Follow this Question
Related Questions
2/3 times pressing a button does nothing. 1 Answer
Problem With Walking Sounds 1 Answer
On button press/hold = input from a keyboard? 1 Answer
Need delayed reaction after key press 1 Answer
Switch from GUI button to toggle key 1 Answer