An audio source is a Unity component that can be attached to any Unity object. For the purpose of this guide we will just be using an empty asset.
To play back this audio source on the GamePad, we need to configure it in a script.
AudioPlayer
.AudioSource
playing, the code requires the following.AudioSource
AudioSourceOutput
AudioSource
being told to play
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | using UnityEngine; using System.Collections; using WiiU = UnityEngine.WiiU; public class AudioPlayer : MonoBehaviour { private AudioSource source; // Use this for initialization void Start () { // Get the AudioSource from the object and assign it to the GamePad. source = GetComponent<AudioSource>(); WiiU.AudioSourceOutput.Assign(source, WiiU.AudioOutput.GamePad); source.loop = true; source.Play(); } } |
CONFIDENTIAL