As with most things in Unity there’s a fairly reasoned logic to how this is done. You need three main things:
- An audio source. You can think of this as the media player, it is literally the source of the audio within your environment
- An audio clip. This is the actual audio file that will be played by your audio source. So think of this as the song that will be played by your media player
- An audio listener. This is effectivly your virtual ears within the virtual world. Normally this is attached to your main camera.
To give you an example of how I this works in practice. I first attached a GvrAudioListener to my main camera. This will allow my player to hear the sounds produced. Next add a GvrAudioSource to a GameObject you want to produce a sound. Now load your audio source (your media player) with an audio clip. There’s a few different supported formats, any old mp3 will work nicely. Just drag your MP3 into the audio click field of your GvrAudioSource. By default the audio will play on wake, so just hit play to enter game mode and you should hear your new audio right away.
For more information on the ins and outs of Google Cardboard Audio capabilities, check out the documentation.
Pro Tip: If you find your audio doesn’t play, try clicking edit -> project settings -> audio and make sure the “Spatializer plugin” is set to Gvr.