Camera Controller
Description
The project uses Cinemachine to manage all camera behavior.
Each virtual camera is responsible for a specific gameplay state (start, gameplay, finish, UI), allowing smooth transitions and flexible camera control via Cinemachine.

Camera Context Hierarchy
All cameras in the scene are grouped under the CameraContext object. This object is responsible for managing different camera states during gameplay.
CameraContext contains the following cameras:
MainCamera The base Unity camera used as the main rendering camera.
VirtualStartCamera Used at the beginning of the level (idle state).
VirtualFollowCamera The primary gameplay camera that follows the player.
VirtualFinishCamera Activated at the end of the level.
UICamera Dedicated camera for rendering UI elements.
This structure allows easy switching between camera states and keeps all camera-related objects organized in a single context.
CameraSwitcher
When working with the camera system, pay attention to the CameraSwitcher class.
CameraSwitcher is a helper component responsible for initializing and switching between player-related Cinemachine virtual cameras.
It assigns the player transform as Follow and LookAt targets for the start, follow, and finish cameras, and controls which camera is active by changing their Priority values.
Camera transitions are handled via CinemachineBrain, with separate blend settings for gameplay and finish states, allowing smooth and configurable camera blending during state changes.
To allow the camera system to be managed by Zenject, references to the CameraSwitcher and the player camera are registered in the GameplayInstaller component.

For more information about installers and how they work in Zenject, refer to the official documentation here.
Last updated