I added 5 songs but only 1 is playing?

I checked “Play on awake” on one of the songs and whenever I click the trigger that has the “play on awake” checked on it, the song will play.

However, I tried to check “Play on awake” on other songs and it would play but I don’t want all of them to be playing at the same time, that’s why I only have “Play on awake” on one song.

Basically, the other triggers would stop the song that has “Play on awake” on it but it won’t play the song that is assigned to be played on that trigger.

How its currently set up, all sources would play. Since you are using SDK2 you can’t really directly check if one track is finished to switch to the other. Though very round about, you can use an animation state machine.

Before I get into the detail let me explain how it will work. You music will still be play on awake, but each audio source will be disabled (gameObject or Component). The animator will be set up to move between them and move to another if another is chosen.

Start by disabling you music tracks, then create a folder to store you animation files. In that folder right click to create an animator controller, name it appropriately. Next add a animator component to the parent of you music gameobjects and then add the animator controller asset you just created.

Open up the animation window, create a new animation that will be your first track. While recording that animation enable that track, make that animation exactly 1 second long. Repeat this for every track. You animator will fill with your animations.

Next organize those animations in your animator. The playlist order you want, right click “Make Transition” from one track to another. The animations should flow from one to another. Click the transition arrows and set their Exit time to 1, and transition time to 0.

Next take the any state icon, and make a transition to every animation, set their transition time to 0.

Next make an Parameter in the animator (make that Parameter tab active if it isn’t). Make Parameter of type Trigger for every track in your play list. Name thing something memorable, we will copy and paste their names from here to VRC Triggers later.

In the any state transitions, add a condition, it should be the its respective parameter you just made. That way when you enable that Trigger, it will automatically transition to the correct track.

Go into play mode and make sure you animator works correctly. Currently the animations will be too short, but that is ok for testing purposes. Once its all correct move on.

Check the length of each track. Convert it to only seconds, you can do minutes *60 + seconds. Clock on the animation in the animator, the inspector should give you details. In the area named Speed, put in the length of the track in seconds, but divide it by one. You can put in the math function without putting it thought a calculator. Now it will be the length of your track. Do this for every track.

Next is your VRC triggers. Set up a interact. Make each one an animator Set Trigger. Give it the animator you just set up, and copy the respective name from the animator. The trigger should now make the transition when you press it. Do this for every song.

1 Like