Class CinemachineCore
A singleton that manages complete lists of CinemachineBrain and, CinemachineCamera, and the priority queue. Provides services to keeping track of whether CinemachineCameras have been updated each frame.
Inherited Members
Namespace: Unity.Cinemachine
Assembly: Unity.Cinemachine.dll
Syntax
public static class CinemachineCore
Fields
BlendCreatedEvent
This event will fire when a blend is created.
Handler can modify the settings of the blend (but not the cameras).
Note: BlendCreatedEvents are NOT sent for timeline blends, as those are expected
to be controlled 100% by timeline. To modify the blend algorithm for timeline blends,
you can install a handler for CinemachineCore.GetCustomBlender.
Declaration
public static CinemachineCore.BlendEvent BlendCreatedEvent
Field Value
Type | Description |
---|---|
CinemachineCore.BlendEvent |
BlendFinishedEvent
This event will fire when the current camera completes a blend-in.
Declaration
public static CinemachineCore.CameraEvent BlendFinishedEvent
Field Value
Type | Description |
---|---|
CinemachineCore.CameraEvent |
CameraActivatedEvent
This event will fire when the current camera changes, at the start of a blend
Declaration
public static ICinemachineCamera.ActivationEvent CameraActivatedEvent
Field Value
Type | Description |
---|---|
ICinemachineCamera.ActivationEvent |
CameraDeactivatedEvent
This event will fire immediately after a camera that is live in some context stops being live.
Declaration
public static CinemachineCore.CameraEvent CameraDeactivatedEvent
Field Value
Type | Description |
---|---|
CinemachineCore.CameraEvent |
CameraUpdatedEvent
This event will fire after a brain updates its Camera
Declaration
public static CinemachineCore.BrainEvent CameraUpdatedEvent
Field Value
Type | Description |
---|---|
CinemachineCore.BrainEvent |
CurrentTimeOverride
If non-negative, cinemachine will use this value whenever it wants current game time. Usage is for master timelines in manual update mode, for deterministic behaviour.
Declaration
public static float CurrentTimeOverride
Field Value
Type | Description |
---|---|
float |
GetBlendOverride
Delegate for overriding a blend that is about to be applied to a transition. A handler can either return the default blend, or a new blend specific to current conditions.
Declaration
public static CinemachineCore.GetBlendOverrideDelegate GetBlendOverride
Field Value
Type | Description |
---|---|
CinemachineCore.GetBlendOverrideDelegate |
GetCustomBlender
Delegate for replacing a standard CinemachineBlend with a custom blender class. Returns a new instance of a custom blender, or null to use the default blender.
Declaration
public static CinemachineCore.GetCustomBlenderDelegate GetCustomBlender
Field Value
Type | Description |
---|---|
CinemachineCore.GetCustomBlenderDelegate |
GetInputAxis
Delegate for overriding Unity's default input system. If you set this, then your delegate will be called instead of System.Input.GetAxis(axisName) whenever in-game user input is needed.
Declaration
public static CinemachineCore.AxisInputDelegate GetInputAxis
Field Value
Type | Description |
---|---|
CinemachineCore.AxisInputDelegate |
UniformDeltaTimeOverride
If non-negative, cinemachine will update with this uniform delta time. Usage is for timelines in manual update mode.
Declaration
public static float UniformDeltaTimeOverride
Field Value
Type | Description |
---|---|
float |
kPackageRoot
The root directory where Cinemachine is installed
Declaration
public const string kPackageRoot = "Packages/com.unity.cinemachine"
Field Value
Type | Description |
---|---|
string |
Properties
CurrentTime
Replacement for Time.time, taking CurrentTimeTimeOverride into account.
Declaration
public static float CurrentTime { get; }
Property Value
Type | Description |
---|---|
float |
DeltaTime
Replacement for Time.deltaTime, taking UniformDeltaTimeOverride into account.
Declaration
public static float DeltaTime { get; }
Property Value
Type | Description |
---|---|
float |
SoloCamera
API for the Unity Editor. Show this camera no matter what. This is static, and so affects all Cinemachine brains.
Declaration
public static ICinemachineCamera SoloCamera { get; set; }
Property Value
Type | Description |
---|---|
ICinemachineCamera |
VirtualCameraCount
List of all active CinemachineCameras for all brains. This list is kept sorted by priority.
Declaration
public static int VirtualCameraCount { get; }
Property Value
Type | Description |
---|---|
int |
Methods
FindPotentialTargetBrain(CinemachineVirtualCameraBase)
Try to find a CinemachineBrain to associate with a CinemachineCamera. The first CinemachineBrain in which this CinemachineCamera is live will be used. If none, then the first active CinemachineBrain with the correct layer filter will be used. Brains with OutputCamera == null will not be returned. Final result may be null.
Declaration
public static CinemachineBrain FindPotentialTargetBrain(CinemachineVirtualCameraBase vcam)
Parameters
Type | Name | Description |
---|---|---|
CinemachineVirtualCameraBase | vcam | Virtual camera whose potential brain we need. |
Returns
Type | Description |
---|---|
CinemachineBrain | First CinemachineBrain found that might be appropriate for this vcam, or null |
GetVirtualCamera(int)
Access the priority-sorted array of active ICinemachineCamera in the scene.
Declaration
public static CinemachineVirtualCameraBase GetVirtualCamera(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of the camera to access, range 0-VirtualCameraCount |
Returns
Type | Description |
---|---|
CinemachineVirtualCameraBase | The virtual camera at the specified index |
IsLive(ICinemachineCamera)
Is this virtual camera currently actively controlling any Camera?
Declaration
public static bool IsLive(ICinemachineCamera vcam)
Parameters
Type | Name | Description |
---|---|---|
ICinemachineCamera | vcam | The virtual camera in question |
Returns
Type | Description |
---|---|
bool | True if the vcam is currently driving a Brain |
IsLiveInBlend(ICinemachineCamera)
Checks if the vcam is live as part of an outgoing blend in any active CinemachineBrain.
Does not check whether the vcam is also the current active vcam.
Declaration
public static bool IsLiveInBlend(ICinemachineCamera vcam)
Parameters
Type | Name | Description |
---|---|---|
ICinemachineCamera | vcam | The virtual camera to check |
Returns
Type | Description |
---|---|
bool | True if the virtual camera is part of a live outgoing blend, false otherwise |
OnTargetObjectWarped(Transform, Vector3)
Call this to notify all virtual cameras that may be tracking a target that the target's position has suddenly warped to somewhere else, so that the virtual cameras can update their internal state to make the camera warp seamlessly along with the target.
All virtual cameras are iterated so this call will work no matter how many
are tracking the target, and whether they are active or inactive.
Declaration
public static void OnTargetObjectWarped(Transform target, Vector3 positionDelta)
Parameters
Type | Name | Description |
---|---|---|
Transform | target | The object that was warped |
Vector3 | positionDelta | The amount the target's position changed |
ResetCameraState()
Call this to notify all virtual cameras to forget state from the previous frame. This is essentially a reset of all the Cinemachine cameras. It is useful, for example, when you want to restart a game level.
Declaration
public static void ResetCameraState()