UnityGameProjectsCode / NightwatchGame / PlayOnPress.cs
PlayOnPress.cs
Raw
using UnityEngine;

public class PlayOnPress : MonoBehaviour
{
    private AudioSource targetSource;

    private void Awake()
    {
        targetSource = GetComponent<AudioSource>();
    }

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.U))
        {
            targetSource.Play();
            Debug.Log("Done");
        }
    }
}