Class CinemachineCore
A singleton that manages complete lists of CinemachineBrain and, Cinemachine Virtual Cameras, and the priority queue. Provides services to keeping track of whether Cinemachine Virtual Cameras have been updated each frame.
Namespace: Cinemachine
Syntax
public sealed class CinemachineCore
Fields
CameraCutEvent
This event will fire after a brain updates its Camera
Declaration
public static CinemachineBrain.BrainEvent CameraCutEvent
Field Value
Type | Description |
---|---|
CinemachineBrain.BrainEvent |
CameraUpdatedEvent
This event will fire after a brain updates its Camera
Declaration
public static CinemachineBrain.BrainEvent CameraUpdatedEvent
Field Value
Type | Description |
---|---|
CinemachineBrain.BrainEvent |
CurrentTimeOverride
If non-negative, cinemachine willuse 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 |
---|---|
Single |
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 |
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 |
kStreamingVersion
Data version string. Used to upgrade from legacy projects
Declaration
public static readonly int kStreamingVersion
Field Value
Type | Description |
---|---|
Int32 |
sShowHiddenObjects
If true, show hidden Cinemachine objects, to make manual script mapping possible.
Declaration
public static bool sShowHiddenObjects
Field Value
Type | Description |
---|---|
Boolean |
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 |
---|---|
Single |
Properties
BrainCount
Access the array of active CinemachineBrains in the scene
Declaration
public int BrainCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
CurrentTime
Replacement for Time.time, taking CurrentTimeTimeOverride into account.
Declaration
public static float CurrentTime { get; }
Property Value
Type | Description |
---|---|
Single |
DeltaTime
Replacement for Time.deltaTime, taking UniformDeltaTimeOverride into account.
Declaration
public static float DeltaTime { get; }
Property Value
Type | Description |
---|---|
Single |
Instance
Get the singleton instance
Declaration
public static CinemachineCore Instance { get; }
Property Value
Type | Description |
---|---|
CinemachineCore |
VirtualCameraCount
List of all active Cinemachine Virtual Cameras for all brains. This list is kept sorted by priority.
Declaration
public int VirtualCameraCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
FindPotentialTargetBrain(CinemachineVirtualCameraBase)
Try to find a CinemachineBrain to associate with a Cinemachine Virtual Camera. The first CinemachineBrain in which this Cinemachine Virtual Camera 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 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 |
GenerateCameraActivationEvent(ICinemachineCamera, ICinemachineCamera)
Signal that the virtual has been activated. If the camera is live, then all CinemachineBrains that are showing it will send an activation event.
Declaration
public void GenerateCameraActivationEvent(ICinemachineCamera vcam, ICinemachineCamera vcamFrom)
Parameters
Type | Name | Description |
---|---|---|
ICinemachineCamera | vcam | The virtual camera being activated |
ICinemachineCamera | vcamFrom | The previously-active virtual camera (may be null) |
GenerateCameraCutEvent(ICinemachineCamera)
Signal that the virtual camera's content is discontinuous WRT the previous frame. If the camera is live, then all CinemachineBrains that are showing it will send a cut event.
Declaration
public void GenerateCameraCutEvent(ICinemachineCamera vcam)
Parameters
Type | Name | Description |
---|---|---|
ICinemachineCamera | vcam | The virtual camera being cut to |
GetActiveBrain(Int32)
Access the array of active CinemachineBrains in the scene without generating garbage
Declaration
public CinemachineBrain GetActiveBrain(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of the brain to access, range 0-BrainCount |
Returns
Type | Description |
---|---|
CinemachineBrain | The brain at the specified index |
GetVirtualCamera(Int32)
Access the priority-sorted array of active ICinemachineCamera in the scene without generating garbage
Declaration
public CinemachineVirtualCameraBase GetVirtualCamera(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | 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 bool IsLive(ICinemachineCamera vcam)
Parameters
Type | Name | Description |
---|---|---|
ICinemachineCamera | vcam | The virtual camea in question |
Returns
Type | Description |
---|---|
Boolean | 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 bool IsLiveInBlend(ICinemachineCamera vcam)
Parameters
Type | Name | Description |
---|---|---|
ICinemachineCamera | vcam | The virtual camera to check |
Returns
Type | Description |
---|---|
Boolean | True if the virtual camera is part of a live outgoing blend, false otherwise |
OnTargetObjectWarped(Transform, Vector3)
Call this to notify all virtual camewras 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 seamlessy 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 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 |