Referencing scene objects with ActionList 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 once particular camera in one particular scene. So in this tutorial, we'll make a slight change that allows it to work on a particular 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?:

Now our camera is ready to be made a prefab. Drag it from the Hierarchy window into your Project window, 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.

Therefore, whenever we want to cut to an overhead camera for 2 seconds, we can just drag this prefab into the scene, and call our ActionList. This may sound like more effort than it's worth - we could easily make scene-based Cutscenes to do the same thing - but this tutorial demonstrates a techniques that's useful for more complex tasks.

Note, however, that this technique requires that only one object within our scene has a Constant ID number of the referenced value. ID numbers can be shared between scenes, but not between objects in the same scene.

Adventure Creator and this website are copyright Chris Burton, ICEBOX Studios

Go to top
Do NOT follow this link or you will be banned from the site!