All games need a camera, whether it’s moving or not, to display to the player what’s happening in the game. The Infinite Runner Engine comes with its own Camera controller, the CameraBehavior class. It’s optional of course, feel free to replace it with any other camera controller. To use it, simply add a camera to your scene, make it orthographic or perspective, the controller will handle both. Then simply add a CameraBehavior component to it.
There are a few things you can tweak from the CameraBehavior’s inspector. First is the Zoom options. You can define a minimum and maximum zoom. If your camera is orthographic, change the orthographic values, otherwise change its min and max position. During the game, the camera will change its zoom from the min to the max values as the level speed increases. So maybe if your game is going faster and faster you’ll want to progressively zoom out to allow the player to see a little further.
Follow Player and Camera Movement
You can have your camera follow the player as it moves around. You can have it only move on certain axes too. And of course from the Camera’s inspector you can define the Speed at which the camera will move when it tries to follow the player.
From the CameraBehavior’s inspector you can set bounds the camera can’t escape when following the player.
Most cameras in the demo scenes use Unity’s PostProcessing effects. These can be somewhat unreliable on some platforms, so there’s an option in the CameraBehavior’s inspector to remove these effects when running on mobile (auto detection is set for Android and iOS). You can check EnableEffectsOnMobile to force them to stay.