Playing Sound

Im using a C## script and Im wondering how to play sound when I press the H key… it wont work and Im using a .wav sound file, nothing big. I cant get anything to play…

[RequireComponent(typeof(AudioSource))]
public class PlayerHealth : MonoBehaviour {
	public AudioClip PlayerHit;

	// Update is called once per frame
	void Update () {
		if (Input.GetKeyDown (KeyCode.H)) {
			audio.PlayOneShot(PlayerHit); 
				}

Assuming that’s all, your code is good and should work.

Be sure to check taht your sound is either 2D or that your source is close to your Listener (default is on the main camera)

If your sound is defined as “3D”, playing it will considerate audio listener position in 3D space and apply volume changes. Have you tried to use 2D sound ? You can change it in the inspector when selecting your sound in the project window.