How to play Audio on button press

I cannot figure out how to get a button to play audio clip when pressed. Here is the following steps someone wrote:

  • Add an audio source GameObject to your scene

  • Assign an audio clip to it

  • Uncheck “Play on Awake”

  • Go to the OnClick() section of the UI Button

  • Click the plus sign to add an item to the list

  • Assign the Audio Source object to the object field

  • Choose AudioSource.Play in the dropdown

There is no AudioSource.Play in the drop down only the words No Function…

Anyone have any idea how to get this working?

Those steps seem correct to me. If you only have No Function listed then there’s something wrong probably with the object assignment. You sure you have an object selected for the OnClick? Even if you just have an empty gameobject assigned, you should still get more than just No Function in the drop down.

Where is “Play On Awake”?