Splitting a Master Sequence between Scenes in Unity

I am using Unity Sequences to create a cartoon series (slowly). It is probably more accurate to say I am learning the technology to create such a series as so far I have spent more time on technology than delivering results! But getting closer. One problem I came across was how to split a Unity scene with Sequences into two scenes. This is the best solution I have come up with to date.

Why did I want to split a scene? I have a school location with “Day” and “Night” where night has lights turned on in the school yard etc. I was trying to turn lights on/off via animation and scripts, but in practice I found scrubbing around the timelines required every timeline to turn the lights on or off, or else it could be left in the wrong state.

So I created two prefab variants of the School prefab — one with lights permanently off (Day), the other permanently on (Night). I then created a scene per prefab. A potential side benefit is baked lighting works better without radical lighting changes in a scene (baking is stored per scene and assumes lighting in a scene is relatively static).

My problem was I had lots of Sequences already created. Half I now wanted to move from my Day scene to my Night scene. I started trying to move the existing Timeline assets over to the new scene. But the Sequences package did not like this. I could not work out how to unlink the Timelines from the old scene and link them up with the new scene and have all the normal Sequences functionality keep working.

Please note: I am creating animation tracks directly under shot sequences and not using the Sequence support where a character stores the animation tracks as variants of the character (the default way Unity intends Sequences to be used). I find it easier to manage.

So the following process is what I ended up with, which is based on making a copy of the existing sequence in the new scene. The steps are:

  • Create the new scene (Night for me)
  • Create a new Master Sequence, beat sequences, and shot sequences for the shots to be copied into the new scene (I always create 3 levels of sequences).
  • Open the Day scene, then right click on the Night scene asset in the Project window and select “Open Scene Additive” (thanks Kylo!) – the two scenes are now open in the Hierarchy window.
  • The two scenes should now appear one above the other in the hierarchy window. (To close it later, right click on the second scene in the Hierarchy window and select “Remove Scene” from the menu.)
  • Expand the sequences hierarchy of the first scene to show game objects, then copy all the objects from the top scene (the source) under the shot sequence in the bottom (destination) scene. I have all my character prefabs, volumes, etc here. (I click on the first child, shift-click on the last child, then CTRL-C to copy. By copying them all at once it preserves linkages between the objects. If you copy the objects one by one, the linkages between objects is lost.)
  • Select the shot timeline (click on the shot game object) and copy all of the tracks from the source scene timeline. (I click below the timelines and press CTRL-A to select all).

  • Select the destination scene timeline and paste them into the empty timeline.

There is a problem however. Copying the game objects and tracks across loses the linkages because you cannot copy the game objects AND the animation tracks at the same time (you need to paste them in different locations). You will see little yellow triangles against the bindings in the new scene. So you have to fix them by hand.

  • In the new scene, drag the corresponding game objects from the new scene hierarchy to the bindings for the track to link them up correctly again.
  • You will also have to fix/redo any Cinemachine tracks as any Cinemachine Virtual Camera clips will be referring to the old virtual camera objects.
  • You may find other linkages you need to fix as well.

It is time consuming, so it is better to plan in advance and have separate scenes from the beginning. I may even move towards a plan of around 50 shots scene, starting a new scene more often, to minimize any later refactoring. But if you need to do it, this is the safest route I found. At least it was possible.

Theoretically you could delete the old sequences from the old scene. I am not – I am leaving them there. I worry that there might be some underlying shared assets that break things by accident. So instead I am just removing those shots from the beat sequences (my current favorite name for the level of sequence under the master sequence. That way they don’t render, but I have them handy in case I find something else broken later that I missed.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s