Click audio feedback

For the audio, find an audio clip you'd like to use when something is clicked. We include one named FingerPressed with our chapter Assets package. Rather than adding it with an AudioSource to every button and clickable object, we'll centralize the sound and add it to the GameController, along with a PlayClickFeedback() function:

  1. Select the GameController in Hierarchy and Add Component Audio Source.
  2. Find your audio clip, such as at Assets/SimpleIcons/Sounds/FingerPressed, and drag it into the AudioClip slot on the Audio Source component.
  3. Uncheck Play On Awake.
  4. Leave the Spatial Blend at 2D so it's not affected by the user's head position.

Now edit the GameController script:

File: GameController.cs private AudioSource ...

Get Augmented Reality for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.