To schedule a sound to play after a given delay, perform the following steps:
- Create a new Unity 2D project and import the sound clip files.
- Create a GameObject in the scene containing an AudioSource component linked to the Pacman Opening Song AudioClip. This can be done in a single step by dragging the music clip from the Project panel into either the Hierarchy panel or the Scene panel.
- Repeat the previous step to create another GameObject, containing an AudioSource component linked to the Pacman Dies clip.
- For both AudioSource components created, uncheck the Play Awake property. This is so that the sounds do not begin playing as soon as the scene is loaded.
- Create a UI Button named Button-music on the screen and change its text to Play Music Immediately.
- Create a UI Button named Button-dies on the screen and change its text to Play Dies Sound After 1 second.
- Create an empty GameObject named SoundManager.
- Create a C# script class, called ...