Let’s play a sound effect on this wand when it is picked up.
To do this, create a new script called PlayOnGrab. Delete When World is Started, and under Grab Events, bring over When Object is Grabbed by Player. Then, from the Actions tab, grab the Play Sound code block, and place it under the event.
We will then create a new object variable, called Sound. Drag the Sound pill over to replace Self. Select a sound effect from your build menu, and bring it into the Wand’s grouping. Make sure to open the property panel on the sound effect before zooming out of the grouping.
From the Wand’s property panel, attach the PlayOnGrab script, and reference the Sound Effect. Now let’s try it out.
Important
You can also use other buttons found on your controller to play sounds, by using the controller button events.