Class CinemachineCameraManagerBase
This is a virtual camera "manager" that owns and manages a collection of child Cm Cameras.
Inheritance
Inherited Members
Namespace: Unity.Cinemachine
Assembly: Unity.Cinemachine.dll
Syntax
public abstract class CinemachineCameraManagerBase : CinemachineVirtualCameraBase, ICinemachineMixer, ICinemachineCamera
Fields
CustomBlends
This is the asset which contains custom settings for specific child blends.
Declaration
[Tooltip("This is the asset which contains custom settings for specific child blends")]
[FormerlySerializedAs("m_CustomBlends")]
public CinemachineBlenderSettings CustomBlends
Field Value
Type | Description |
---|---|
CinemachineBlenderSettings |
DefaultBlend
The blend which is used if you don't explicitly define a blend between two Virtual Camera children.
Declaration
[Tooltip("The blend which is used if you don't explicitly define a blend between two Virtual Camera children")]
[FormerlySerializedAs("m_DefaultBlend")]
public CinemachineBlendDefinition DefaultBlend
Field Value
Type | Description |
---|---|
CinemachineBlendDefinition |
DefaultTarget
If enabled, a default target will be available. It will be used if a child rig needs a target and doesn't specify one itself.
Declaration
[FoldoutWithEnabledButton("Enabled")]
public CinemachineCameraManagerBase.DefaultTargetSettings DefaultTarget
Field Value
Type | Description |
---|---|
CinemachineCameraManagerBase.DefaultTargetSettings |
Properties
ActiveBlend
Get the current blend in progress. Returns null if none. It is also possible to set the current blend, but this is not a recommended usage unless it is to set the active blend to null, which will force completion of the blend.
Declaration
public CinemachineBlend ActiveBlend { get; set; }
Property Value
Type | Description |
---|---|
CinemachineBlend |
ChildCameras
The list of child cameras. These are just the immediate children in the hierarchy.
Declaration
public List<CinemachineVirtualCameraBase> ChildCameras { get; }
Property Value
Type | Description |
---|---|
List<CinemachineVirtualCameraBase> |
Description
Gets a brief debug description of this virtual camera, for use when displaying debug info
Declaration
public override string Description { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
Follow
Get the current Follow target. Returns parent's Follow if parent is non-null and no specific Follow defined for this camera
Declaration
public override Transform Follow { get; set; }
Property Value
Type | Description |
---|---|
Transform |
Overrides
IsBlending
Is there a blend in progress?
Declaration
public bool IsBlending { get; }
Property Value
Type | Description |
---|---|
bool |
LiveChild
Get the current active camera. Will return null if no camera is active.
Declaration
public ICinemachineCamera LiveChild { get; }
Property Value
Type | Description |
---|---|
ICinemachineCamera |
LookAt
Get the current LookAt target. Returns parent's LookAt if parent is non-null and no specific LookAt defined for this camera
Declaration
public override Transform LookAt { get; set; }
Property Value
Type | Description |
---|---|
Transform |
Overrides
PreviousStateIsValid
Set this to force the next update to ignore state from the previous frame.
This is useful, for example, if you want to cancel damping or other time-based processing.
Declaration
public override bool PreviousStateIsValid { get; set; }
Property Value
Type | Description |
---|---|
bool |
Overrides
State
The CameraState object holds all of the information necessary to position the Unity camera. It is the output of this class.
Declaration
public override CameraState State { get; }
Property Value
Type | Description |
---|---|
CameraState |
Overrides
Methods
ChooseCurrentCamera(Vector3, float)
Choose the appropriate current camera from among the ChildCameras, based on current state. If the returned camera is different from the current camera, an appropriate transition will be made.
Declaration
protected abstract CinemachineVirtualCameraBase ChooseCurrentCamera(Vector3 worldUp, float deltaTime)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | worldUp | Default world Up, set by the CinemachineBrain |
float | deltaTime | Delta time for time-based effects (ignore if less than or equal to 0) |
Returns
Type | Description |
---|---|
CinemachineVirtualCameraBase | The current child camera that should be active. Must be present in ChildCameras. |
FinalizeCameraState(float)
At the end of InternalUpdateCameraState, call this to finalize the state
Declaration
protected void FinalizeCameraState(float deltaTime)
Parameters
Type | Name | Description |
---|---|---|
float | deltaTime | Current deltaTime for this frame |
ForceCameraPosition(Vector3, Quaternion)
Force the virtual camera to assume a given position and orientation
Declaration
public override void ForceCameraPosition(Vector3 pos, Quaternion rot)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | pos | World-space position to take |
Quaternion | rot | World-space orientation to take |
Overrides
InternalUpdateCameraState(Vector3, float)
Internal use only. Do not call this method. Called by CinemachineCore at designated update time so the vcam can position itself and track its targets. This implementation updates all the children, chooses the best one, and implements any required blending.
Declaration
public override void InternalUpdateCameraState(Vector3 worldUp, float deltaTime)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | worldUp | Default world Up, set by the CinemachineBrain |
float | deltaTime | Delta time for time-based effects (ignore if less than or equal to 0) |
Overrides
InvalidateCameraCache()
Force a rebuild of the child camera cache.
Call this if CinemachineCamera children are added or removed dynamically
Declaration
public void InvalidateCameraCache()
IsLiveChild(ICinemachineCamera, bool)
Check whether the cam is a live child of this camera.
Declaration
public virtual bool IsLiveChild(ICinemachineCamera cam, bool dominantChildOnly = false)
Parameters
Type | Name | Description |
---|---|---|
ICinemachineCamera | cam | |
bool | dominantChildOnly | If true, will only return true if this vcam is the dominant live child |
Returns
Type | Description |
---|---|
bool | True if the vcam is currently actively influencing the state of this vcam |
LookupBlend(ICinemachineCamera, ICinemachineCamera)
Find a blend curve for blending from one child camera to another.
Declaration
protected virtual CinemachineBlendDefinition LookupBlend(ICinemachineCamera outgoing, ICinemachineCamera incoming)
Parameters
Type | Name | Description |
---|---|---|
ICinemachineCamera | outgoing | The camera we're blending from. |
ICinemachineCamera | incoming | The camera we're blending to. |
Returns
Type | Description |
---|---|
CinemachineBlendDefinition | The blend to use for this camera transition. |
OnDisable()
Standard MonoBehaviour OnDisable. Derived classes must call base class implementation.
Declaration
protected override void OnDisable()
Overrides
OnEnable()
Standard MonoBehaviour OnEnable. Derived classes must call base class implementation.
Declaration
protected override void OnEnable()
Overrides
OnTargetObjectWarped(Transform, Vector3)
This is called to notify the vcam that a target got warped, so that the vcam can update its internal state to make the camera also warp seamlessly.
Declaration
public override 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 |
Overrides
OnTransformChildrenChanged()
Makes sure the internal child cache is up to date
Declaration
protected virtual void OnTransformChildrenChanged()
OnTransitionFromCamera(ICinemachineCamera, Vector3, float)
Notification that this virtual camera is going live.
Declaration
public override void OnTransitionFromCamera(ICinemachineCamera fromCam, Vector3 worldUp, float deltaTime)
Parameters
Type | Name | Description |
---|---|---|
ICinemachineCamera | fromCam | The camera being deactivated. May be null. |
Vector3 | worldUp | Default world Up, set by the CinemachineBrain |
float | deltaTime | Delta time for time-based effects (ignore if less than or equal to 0) |
Overrides
Reset()
Reset the component to default values.
Declaration
protected virtual void Reset()
ResetLiveChild()
Cancel current active camera and all blends
Declaration
protected void ResetLiveChild()
SetLiveChild(ICinemachineCamera, Vector3, float)
Set the current active camera. All necessary blends will be created, and events generated.
Declaration
protected void SetLiveChild(ICinemachineCamera activeCamera, Vector3 worldUp, float deltaTime)
Parameters
Type | Name | Description |
---|---|---|
ICinemachineCamera | activeCamera | Current active camera |
Vector3 | worldUp | Current world up |
float | deltaTime | Current deltaTime applicable for this frame |
UpdateCameraCache()
Rebuild the camera cache if it's been invalidated
Declaration
protected virtual bool UpdateCameraCache()
Returns
Type | Description |
---|---|
bool | True if a cache rebuild was performed, false if cache is up to date. |