To play different sounds with their own AudioSouce components, 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 that is linked to the 186772__dafawe__medieval AudioClip. You can do this in a single step by dragging the music clip from the Project panel into either the Hierarchy panel or the Scene panel. Rename this new GameObject as music1_medieval.
- Repeat the previous step to create another GameObject, named music2_arcade, containing an AudioSource component that is linked to 251461__joshuaempyre__arcade-music-loop.
- For both AudioSource components that have been created, uncheck the Play On Awake property. This is so that the sounds do not begin playing as soon as the scene has been loaded.
- Create an empty GameObject named Manager.
- Create a C# script class, called MusicManager, in a new folder, _Scripts, that contains...