Hi, guys!
I tried to make script which would make a sound after pressing any buttons.
I tried this script:
using UnityEngine;
using System.Collections;
public class KeyPressSound : MonoBehaviour {
void onGUI() {
Event e = Event.current;
if (e.isKey)
Debug.Log("Detected a keyboard event!" + e);
audio.Play();
}
void Update(){
}
}
But it doesn’t make a sound What is my mistake? Thanks!