Scene objects and assets 2

In the last tutorial, we used an asset-based ActionList to cut to an overhead camera within the scene. However, it only works for one particular camera in one particular scene. In this tutorial, we'll make a slight change so that we can have it cut to a specific camera in any scene.

Find the OverheadCam we created, and find the Constant ID component in it's Inspector:

We'll want to turn this camera into a prefab, so that we can use it in all of our scenes. However, when we do so, you'll notice that the prefab instance will have it's Constant ID number reset to zero. This is to ensure that - unless we choose otherwise - all objects have an ID number that is unique to that object.

Because our ActionList asset references the camera by it's ID number, we want to share this ID number with all instances of the OverheadCam object in our scene. To do this, simply check Retain in prefab?.

Drag it from the Hierarchy window into the Project window to make it a prefab - and you'll see that the ID number is retained.

Open up another scene (or a blank one), and drag the prefab back into the Hierarchy. When our ActionList asset is run within this scene, this new camera will be referenced instead.

But what if we want to choose which camera we want to momentarily cut to on the fly - or how long for? We can do that by using ActionList parameters - and we'll cover them in the next tutorial.