UI feedback
Before we're done, let's add a little juice to the user experience. We have a feedback cursor that lets you know what you're gazing at, and the cursor changes shape when the device recognizes your hand in view. But we do not have feedback when a button or clickable object is clicked. Let's add an audio feedback and some animation.
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:
- Select the
GameController
inHierarchy
andAdd Component
Audio Source
. - Find your audio clip, such as at
Assets/SimpleIcons/Sounds/FingerPressed
, and drag it into theAudioClip
slot on theAudio Source
component. - Uncheck
Play On Awake
. - Leave the
Spatial Blend
at2D
so it's not affected by the user's head position...