My journey becoming a Unity game developer: Audio Manager: Intro Cutscene Music Fixed and Cleanup
Objective: Fix the background music to play after the Intro Cutscene finish playing. Also, turn off the cutscene when it finish playing and bring back Darren the player character.
Let’s start by opening the Intro Cutscene Timeline editor. Create an Animation Track, drag Background Music into its slot, and click the REC button as we will animate when the music plays during the cutscene. Originally we created the 1st keyframe at the beginning of the shot setting the Volume at zero, and the 2nd keyframe at the end of the shot setting the Volume at .3 or the setting that you set the Background Music to with the original music. When we played the cutscene, we can hear at some point in the middle of the cutscene the Background Music playing behind the Intro Cutscene music.
Double-click in the timeline of the Background Music animation track to open the Animation Tab. Click on the 1st keyframe and drag it to the last keyframe of the fade out in the cutscene located in the Canvas animation track. Now the Background Music will start playing at that point in the fade out of the cutscene and stop at the end of the shot in the cutscene.
Next, we need to create 2 new Activation Tracks for the Player and Actors game objects with the Actors located under the Intro Cutscene game object. Make sure the clips are positioned at the beginning of the timeline, and drag the Actors end clip to be one frame in front of the Clip Timing End duration shot. Then, drag the Player clip to the end of the shot’s duration, and the beginning clip to be one frame from the Clip Timing End duration shot.
The Actors will act out the cutscene and disappear one frame before the cutscene ends. The Player will disappear at the beginning of the cutscene, and reappear one frame before the cutscene ends while the screen is faded out.
As we see, Darren the actor in the cutscene is now the only character seen onscreen as the cutscene plays.
The Intro Cutscene will not turn off as we play the cutscene at this moment, therefore changing the Main Camera’s position in the game. Create an Empty game object name Intro Cutscene Holder, and set its Transform positions to zero. Drag the Intro Cutscene itself into this Holder object making it the Parent object for the cutscene.
Select the Intro Cutscene game object to gain access to its Timeline editor. Create a new Activation Track and drag the Intro Cutscene Holder object into its slot to use the Parent object to control the cutscene being disabled. We want the Intro Cutscene Holder activated from the beginning to the next to last frame of the Clip Timing End duration shot. After the last frame in the Activation Track, the cutscene will be disabled through the Holder Parent object as the Holder object will be disabled itself.
Play the game now and the Intro Cutscene turns off when the cutscene finish playing. Just look in the Inspector and see the Intro Cutscene Holder and Intro Cutscene game objects be disabled at the end of the cutscene. However, Darren the Player doesn’t reappear back in the game onscreen.
Adjust the Player’s Activation Track clip to be 2 frames from the end of the Clip Timing End duration shot. This will bring back the Player an extra frame earlier than the end of the fade out animation. Therefore, the Player should reappear right as we go back into the game.
Play the game and when the cutscene ends, look in the Scene View as we will see Darren the Actor disappear and Darren the Player reappear back onscreen in Game mode. However, since we made adjustments within the Intro Cutscene Timeline editor, the Main Camera in the game isn’t properly positioned to work in the game. It’s positioned now at the last camera shot in the cutscene.
Next time we will work on the Intro Cutscene Main Camera fix.