Changing cameras with animation
Not only can we animate cameras using the Animation View, but we can also change the shots in time.
Getting ready
This recipe will also be created from scratch in Unity. You can download the example Unity project provided and go to Chapter 08 Animating Cutscenes\Recipe 02 Changing cameras with animation
directory. You can find a Camera Changer
game object in the Example.unity
scene there, with three cameras as children. If you play the game, the cameras will change.
How to do it...
To change cameras using animation, follow these steps:
- Create an empty game object in the
Scene
View and name itCameraChanger
. - Rename the
Main Camera
toCamera (1)
and copy it two times. You should haveCamera (1)
,Camera (2)
, andCamera (3)
game objects. - Parent all three cameras to the
CameraChanger
. - Place the cameras as you wish.
- Set the
Depth
of the cameras in increasing order. Every new shot should have a greaterDepth
value. - Select the
CameraChanger
game object and open theAnimation...