Cinemachine Events
Cinemachine generates events whenever cameras are activated and deactivated, and also when blends are started and when they finish. Furthermore, an event is generated when there is a camera cut - that is, when the active Cinemachine Camera changes without blending.
When Cinemachine sends an event, it is sent globally via CinemachineCore. Scripts can add listeners to those events and take action based on them. Listeners receive events for all cameras.
Events are generated in every context that manages blends. This includes the CinemachineBrain, which handles blends at the highest level, but it also applies to Cinemachine Manager Cameras, which thenselves manage blends between their child cameras.
Sometimes it's desirable to have events sent only for a specific camera, so that scripts can be notified based on this specific camera's activity without having to provide code to filter the events. Cinemachine provides the following behaviours to execute this filtering logic.
- You can trap events that relate to activating or deactivating a specific CinemachineCamera or ManagerCamera by adding a Cinemachine Camera Events behaviour to it.
- You can trap events generated by a ManagerCamera by adding a Cinemachine Camera Manager Events behaviour to it.
- You can trap events that are generated by a specific CinemachineBrain by adding a Cinemachine Brain Events to it.