docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class CinemachineVirtualCameraBase

    Base class for a Monobehaviour that represents a Virtual Camera within the Unity scene.

    This is intended to be attached to an empty Transform GameObject. Inherited classes can be either standalone virtual cameras such as CinemachineVirtualCamera, or meta-cameras such as CinemachineClearShot or CinemachineFreeLook.

    A CinemachineVirtualCameraBase exposes a Priority property. When the behaviour is enabled in the game, the Virtual Camera is automatically placed in a queue maintained by the static CinemachineCore singleton. The queue is sorted by priority. When a Unity camera is equipped with a CinemachineBrain behaviour, the brain will choose the camera at the head of the queue. If you have multiple Unity cameras with CinemachineBrain behaviours (say in a split-screen context), then you can filter the queue by setting the culling flags on the virtual cameras. The culling mask of the Unity Camera will then act as a filter for the brain. Apart from this, there is nothing that prevents a virtual camera from controlling multiple Unity cameras simultaneously.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    CinemachineVirtualCameraBase
    CinemachineBlendListCamera
    CinemachineClearShot
    CinemachineExternalCamera
    CinemachineFreeLook
    CinemachineMixingCamera
    CinemachineStateDrivenCamera
    CinemachineVirtualCamera
    Implements
    ICinemachineCamera
    ISerializationCallbackReceiver
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(string, float)
    MonoBehaviour.InvokeRepeating(string, float, float)
    MonoBehaviour.CancelInvoke(string)
    MonoBehaviour.IsInvoking(string)
    MonoBehaviour.StartCoroutine(string)
    MonoBehaviour.StartCoroutine(string, object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(string)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(object)
    MonoBehaviour.destroyCancellationToken
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, out Component)
    Component.TryGetComponent<T>(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(bool)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(bool)
    Component.GetComponentsInChildren<T>(bool, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type, bool)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>(bool)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(bool)
    Component.GetComponentsInParent<T>(bool, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.GetComponentIndex()
    Component.CompareTag(string)
    Component.SendMessageUpwards(string, object, SendMessageOptions)
    Component.SendMessageUpwards(string, object)
    Component.SendMessageUpwards(string)
    Component.SendMessageUpwards(string, SendMessageOptions)
    Component.SendMessage(string, object)
    Component.SendMessage(string)
    Component.SendMessage(string, object, SendMessageOptions)
    Component.SendMessage(string, SendMessageOptions)
    Component.BroadcastMessage(string, object, SendMessageOptions)
    Component.BroadcastMessage(string, object)
    Component.BroadcastMessage(string)
    Component.BroadcastMessage(string, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.InstantiateAsync<T>(T)
    Object.InstantiateAsync<T>(T, Transform)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int)
    Object.InstantiateAsync<T>(T, int, Transform)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, InstantiateParameters)
    Object.InstantiateAsync<T>(T, int, InstantiateParameters)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion, InstantiateParameters)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion, InstantiateParameters)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, InstantiateParameters)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Scene)
    Object.Instantiate<T>(T, InstantiateParameters)
    Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(FindObjectsInactive)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Cinemachine
    Assembly: Cinemachine.dll
    Syntax
    public abstract class CinemachineVirtualCameraBase : MonoBehaviour, ICinemachineCamera, ISerializationCallbackReceiver

    Fields

    FollowTargetAttachment

    This must be set every frame at the start of the pipeline to relax the virtual camera's attachment to the target. Range is 0...1.
    1 is full attachment, and is the normal state. 0 is no attachment, and virtual camera will behave as if no Follow targets are set.

    Declaration
    [NonSerialized]
    public float FollowTargetAttachment
    Field Value
    Type Description
    float

    LookAtTargetAttachment

    This must be set every frame at the start of the pipeline to relax the virtual camera's attachment to the target. Range is 0...1.
    1 is full attachment, and is the normal state. 0 is no attachment, and virtual camera will behave as if no LookAt targets are set.

    Declaration
    [NonSerialized]
    public float LookAtTargetAttachment
    Field Value
    Type Description
    float

    m_ExcludedPropertiesInInspector

    Inspector control - Use for hiding sections of the Inspector UI.

    Declaration
    [HideInInspector]
    [SerializeField]
    public string[] m_ExcludedPropertiesInInspector
    Field Value
    Type Description
    string[]

    m_LockStageInInspector

    Inspector control - Use for enabling sections of the Inspector UI.

    Declaration
    [HideInInspector]
    [SerializeField]
    public CinemachineCore.Stage[] m_LockStageInInspector
    Field Value
    Type Description
    Stage[]

    m_Priority

    The priority will determine which camera becomes active based on the state of other cameras and this camera. Higher numbers have greater priority.

    Declaration
    [Tooltip("The priority will determine which camera becomes active based on the state of other cameras and this camera.  Higher numbers have greater priority.")]
    public int m_Priority
    Field Value
    Type Description
    int

    m_StandbyUpdate

    When the virtual camera is not live, this is how often the virtual camera will be updated. Set this to tune for performance. Most of the time Never is fine, unless the virtual camera is doing shot evaluation.

    Declaration
    [Tooltip("When the virtual camera is not live, this is how often the virtual camera will be updated.  Set this to tune for performance. Most of the time Never is fine, unless the virtual camera is doing shot evaluation.")]
    public CinemachineVirtualCameraBase.StandbyUpdateMode m_StandbyUpdate
    Field Value
    Type Description
    CinemachineVirtualCameraBase.StandbyUpdateMode

    Properties

    AbstractFollowTargetGroup

    Get Follow target as ICinemachineTargetGroup, or null if target is not a ICinemachineTargetGroup

    Declaration
    public ICinemachineTargetGroup AbstractFollowTargetGroup { get; }
    Property Value
    Type Description
    ICinemachineTargetGroup

    AbstractLookAtTargetGroup

    Get LookAt target as ICinemachineTargetGroup, or null if target is not a ICinemachineTargetGroup

    Declaration
    public ICinemachineTargetGroup AbstractLookAtTargetGroup { get; }
    Property Value
    Type Description
    ICinemachineTargetGroup

    Description

    Gets a brief debug description of this virtual camera, for use when displayiong debug info

    Declaration
    public virtual string Description { get; }
    Property Value
    Type Description
    string

    Follow

    Get the Follow target for the Body component in the Cinemachine pipeline.

    Declaration
    public abstract Transform Follow { get; set; }
    Property Value
    Type Description
    Transform

    FollowTargetAsVcam

    Get Follow target as CinemachineVirtualCameraBase, or null if target is not a CinemachineVirtualCameraBase

    Declaration
    public CinemachineVirtualCameraBase FollowTargetAsVcam { get; }
    Property Value
    Type Description
    CinemachineVirtualCameraBase

    FollowTargetChanged

    This property is true if the Follow target was changed this frame.

    Declaration
    public bool FollowTargetChanged { get; }
    Property Value
    Type Description
    bool

    IsValid

    Returns false if the object has been deleted

    Declaration
    public bool IsValid { get; }
    Property Value
    Type Description
    bool

    LookAt

    Get the LookAt target for the Aim component in the Cinemachine pipeline.

    Declaration
    public abstract Transform LookAt { get; set; }
    Property Value
    Type Description
    Transform

    LookAtTargetAsVcam

    Get LookAt target as CinemachineVirtualCameraBase, or null if target is not a CinemachineVirtualCameraBase

    Declaration
    public CinemachineVirtualCameraBase LookAtTargetAsVcam { get; }
    Property Value
    Type Description
    CinemachineVirtualCameraBase

    LookAtTargetChanged

    This property is true if the LookAttarget was changed this frame.

    Declaration
    public bool LookAtTargetChanged { get; }
    Property Value
    Type Description
    bool

    Name

    Get the name of the Virtual Camera. Base implementation returns the owner GameObject's name.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    string

    ParentCamera

    Support for meta-virtual-cameras. This is the situation where a virtual camera is in fact the public face of a private army of virtual cameras, which it manages on its own. This method gets the VirtualCamera owner, if any. Private armies are implemented as Transform children of the parent vcam.

    Declaration
    public ICinemachineCamera ParentCamera { get; }
    Property Value
    Type Description
    ICinemachineCamera

    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 virtual bool PreviousStateIsValid { get; set; }
    Property Value
    Type Description
    bool

    Priority

    Get the Priority of the virtual camera. This determines its placement in the CinemachineCore's queue of eligible shots.

    Declaration
    public int Priority { get; set; }
    Property Value
    Type Description
    int

    State

    The CameraState object holds all of the information necessary to position the Unity camera. It is the output of this class.

    Declaration
    public abstract CameraState State { get; }
    Property Value
    Type Description
    CameraState

    ValidatingStreamVersion

    Version that was last streamed, for upgrading legacy

    Declaration
    public int ValidatingStreamVersion { get; }
    Property Value
    Type Description
    int

    VirtualCameraGameObject

    The GameObject owner of the Virtual Camera behaviour.

    Declaration
    public GameObject VirtualCameraGameObject { get; }
    Property Value
    Type Description
    GameObject

    Methods

    AddExtension(CinemachineExtension)

    A delegate to hook into the state calculation pipeline. This will be called after each pipeline stage, to allow others to hook into the pipeline. See CinemachineCore.Stage.

    Declaration
    public virtual void AddExtension(CinemachineExtension extension)
    Parameters
    Type Name Description
    CinemachineExtension extension

    The extension to add.

    ApplyPositionBlendMethod(ref CameraState, BlendHint)

    Applies a position blend hint to a camera state

    Declaration
    protected void ApplyPositionBlendMethod(ref CameraState state, CinemachineVirtualCameraBase.BlendHint hint)
    Parameters
    Type Name Description
    CameraState state

    The state to apply the hint to

    CinemachineVirtualCameraBase.BlendHint hint

    The hint to apply

    CancelDamping(bool)

    Temporarily cancel damping for this frame. The camera will sanp to its target position when it is updated.

    Declaration
    public void CancelDamping(bool updateNow = false)
    Parameters
    Type Name Description
    bool updateNow

    If true, snap the camera to its target immediately, otherwise wait until the end of the frame when cameras are normally updated.

    CreateBlend(ICinemachineCamera, ICinemachineCamera, CinemachineBlendDefinition, CinemachineBlend)

    Create a blend between 2 virtual cameras, taking into account any existing active blend, with special case handling if the new blend is effectively an undo of the current blend

    Declaration
    protected CinemachineBlend CreateBlend(ICinemachineCamera camA, ICinemachineCamera camB, CinemachineBlendDefinition blendDef, CinemachineBlend activeBlend)
    Parameters
    Type Name Description
    ICinemachineCamera camA

    Outgoing virtual camera

    ICinemachineCamera camB

    Incoming virtual camera

    CinemachineBlendDefinition blendDef

    Definition of the blend to create

    CinemachineBlend activeBlend

    The current active blend

    Returns
    Type Description
    CinemachineBlend

    The new blend

    DetachedFollowTargetDamp(float, float, float)

    Get a damped version of a quantity. This is the portion of the quantity that will take effect over the given time. This method takes the target attachment into account. For general damping without consideration of target attachment, use Damper.Damp()

    Declaration
    public float DetachedFollowTargetDamp(float initial, float dampTime, float deltaTime)
    Parameters
    Type Name Description
    float initial

    The amount that will be damped

    float dampTime

    The rate of damping. This is the time it would take to reduce the original amount to a negligible percentage

    float deltaTime

    The time over which to damp

    Returns
    Type Description
    float

    The damped amount. This will be the original amount scaled by a value between 0 and 1.

    DetachedFollowTargetDamp(Vector3, float, float)

    Get a damped version of a quantity. This is the portion of the quantity that will take effect over the given time. This method takes the target attachment into account. For general damping without consideration of target attachment, use Damper.Damp()

    Declaration
    public Vector3 DetachedFollowTargetDamp(Vector3 initial, float dampTime, float deltaTime)
    Parameters
    Type Name Description
    Vector3 initial

    The amount that will be damped

    float dampTime

    The rate of damping. This is the time it would take to reduce the original amount to a negligible percentage

    float deltaTime

    The time over which to damp

    Returns
    Type Description
    Vector3

    The damped amount. This will be the original amount scaled by a value between 0 and 1.

    DetachedFollowTargetDamp(Vector3, Vector3, float)

    Get a damped version of a quantity. This is the portion of the quantity that will take effect over the given time. This method takes the target attachment into account. For general damping without consideration of target attachment, use Damper.Damp()

    Declaration
    public Vector3 DetachedFollowTargetDamp(Vector3 initial, Vector3 dampTime, float deltaTime)
    Parameters
    Type Name Description
    Vector3 initial

    The amount that will be damped

    Vector3 dampTime

    The rate of damping. This is the time it would take to reduce the original amount to a negligible percentage

    float deltaTime

    The time over which to damp

    Returns
    Type Description
    Vector3

    The damped amount. This will be the original amount scaled by a value between 0 and 1.

    DetachedLookAtTargetDamp(float, float, float)

    Get a damped version of a quantity. This is the portion of the quantity that will take effect over the given time. This method takes the target attachment into account. For general damping without consideration of target attachment, use Damper.Damp()

    Declaration
    public float DetachedLookAtTargetDamp(float initial, float dampTime, float deltaTime)
    Parameters
    Type Name Description
    float initial

    The amount that will be damped

    float dampTime

    The rate of damping. This is the time it would take to reduce the original amount to a negligible percentage

    float deltaTime

    The time over which to damp

    Returns
    Type Description
    float

    The damped amount. This will be the original amount scaled by a value between 0 and 1.

    DetachedLookAtTargetDamp(Vector3, float, float)

    Get a damped version of a quantity. This is the portion of the quantity that will take effect over the given time. This method takes the target attachment into account. For general damping without consideration of target attachment, use Damper.Damp()

    Declaration
    public Vector3 DetachedLookAtTargetDamp(Vector3 initial, float dampTime, float deltaTime)
    Parameters
    Type Name Description
    Vector3 initial

    The amount that will be damped

    float dampTime

    The rate of damping. This is the time it would take to reduce the original amount to a negligible percentage

    float deltaTime

    The time over which to damp

    Returns
    Type Description
    Vector3

    The damped amount. This will be the original amount scaled by a value between 0 and 1.

    DetachedLookAtTargetDamp(Vector3, Vector3, float)

    Get a damped version of a quantity. This is the portion of the quantity that will take effect over the given time. This method takes the target attachment into account. For general damping without consideration of target attachment, use Damper.Damp()

    Declaration
    public Vector3 DetachedLookAtTargetDamp(Vector3 initial, Vector3 dampTime, float deltaTime)
    Parameters
    Type Name Description
    Vector3 initial

    The amount that will be damped

    Vector3 dampTime

    The rate of damping. This is the time it would take to reduce the original amount to a negligible percentage

    float deltaTime

    The time over which to damp

    Returns
    Type Description
    Vector3

    The damped amount. This will be the original amount scaled by a value between 0 and 1.

    ForceCameraPosition(Vector3, Quaternion)

    Force the virtual camera to assume a given position and orientation

    Declaration
    public virtual void ForceCameraPosition(Vector3 pos, Quaternion rot)
    Parameters
    Type Name Description
    Vector3 pos

    Worldspace pposition to take

    Quaternion rot

    Worldspace orientation to take

    GetInputAxisProvider()

    Locate the first component that implements AxisState.IInputAxisProvider.

    Declaration
    public AxisState.IInputAxisProvider GetInputAxisProvider()
    Returns
    Type Description
    AxisState.IInputAxisProvider

    The first AxisState.IInputAxisProvider or null if none

    GetMaxDampTime()

    Query components and extensions for the maximum damping time. Base class implementation queries extensions. Only used in editor for timeline scrubbing.

    Declaration
    public virtual float GetMaxDampTime()
    Returns
    Type Description
    float

    Highest damping setting in this vcam

    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. Do not call this method. Let the framework do it at the appropriate time

    Declaration
    public abstract 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 0)

    InvokeOnTransitionInExtensions(ICinemachineCamera, Vector3, float)

    Invokes the OnTransitionFromCamera for all extensions on this camera

    Declaration
    protected bool InvokeOnTransitionInExtensions(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)

    Returns
    Type Description
    bool

    True to request a vcam update of internal state

    InvokePostPipelineStageCallback(CinemachineVirtualCameraBase, Stage, ref CameraState, float)

    Invokes the PostPipelineStageDelegate for this camera, and up the hierarchy for all parent cameras (if any). Implementaion must be sure to call this after each pipeline stage, to allow other services to hook into the pipeline. See CinemachineCore.Stage.

    Declaration
    protected void InvokePostPipelineStageCallback(CinemachineVirtualCameraBase vcam, CinemachineCore.Stage stage, ref CameraState newState, float deltaTime)
    Parameters
    Type Name Description
    CinemachineVirtualCameraBase vcam

    The virtual camera being processed

    CinemachineCore.Stage stage

    The current pipeline stage

    CameraState newState

    The current virtual camera state

    float deltaTime

    The current applicable deltaTime

    InvokePrePipelineMutateCameraStateCallback(CinemachineVirtualCameraBase, ref CameraState, float)

    Invokes the PrePipelineMutateCameraStateCallback for this camera, and up the hierarchy for all parent cameras (if any). Implementaion must be sure to call this after each pipeline stage, to allow other services to hook into the pipeline. See CinemachineCore.Stage.

    Declaration
    protected void InvokePrePipelineMutateCameraStateCallback(CinemachineVirtualCameraBase vcam, ref CameraState newState, float deltaTime)
    Parameters
    Type Name Description
    CinemachineVirtualCameraBase vcam

    The virtual camera being processed

    CameraState newState

    The current virtual camera state

    float deltaTime

    The current applicable deltaTime

    IsLiveChild(ICinemachineCamera, bool)

    Check whether the vcam a live child of this camera. This base class implementation always returns false.

    Declaration
    public virtual bool IsLiveChild(ICinemachineCamera vcam, bool dominantChildOnly = false)
    Parameters
    Type Name Description
    ICinemachineCamera vcam

    The Virtual Camera to check

    bool dominantChildOnly

    If truw, will only return true if this vcam is the dominat live child

    Returns
    Type Description
    bool

    True if the vcam is currently actively influencing the state of this vcam

    LegacyUpgrade(int)

    Override this to handle any upgrades necessitated by a streaming version change

    Declaration
    protected virtual void LegacyUpgrade(int streamedVersion)
    Parameters
    Type Name Description
    int streamedVersion

    The version that was streamed

    MoveToTopOfPrioritySubqueue()

    When multiple virtual cameras have the highest priority, there is sometimes the need to push one to the top, making it the current Live camera if it shares the highest priority in the queue with its peers.

     This happens automatically when a
     new vcam is enabled: the most recent one goes to the top of the priority subqueue.
     Use this method to push a vcam to the top of its priority peers.
     If it and its peers share the highest priority, then this vcam will become Live.
    
    Declaration
    public void MoveToTopOfPrioritySubqueue()

    OnDestroy()

    Maintains the global vcam registry. Always call the base class implementation.

    Declaration
    protected virtual void OnDestroy()

    OnDisable()

    Base class implementation makes sure the priority queue remains up-to-date.

    Declaration
    protected virtual void OnDisable()

    OnEnable()

    Base class implementation adds the virtual camera from the priority queue.

    Declaration
    protected virtual void OnEnable()

    OnTargetObjectWarped(Transform, Vector3)

    This is called to notify the component that a target got warped, so that the component can update its internal state to make the camera also warp seamlessy.

    Declaration
    public virtual 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

    OnTransformParentChanged()

    Base class implementation makes sure the priority queue remains up-to-date.

    Declaration
    protected virtual void OnTransformParentChanged()

    OnTransitionFromCamera(ICinemachineCamera, Vector3, float)

    Notification that this virtual camera is going live. Base class implementation must be called by any overridden method.

    Declaration
    public virtual 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)

    OnValidate()

    Enforce bounds for fields, when changed in inspector. Call base class implementation at the beginning of overridden method. After base method is called, ValidatingStreamVersion will be valid.

    Declaration
    protected virtual void OnValidate()

    PullStateFromVirtualCamera(Vector3, ref LensSettings)

    Create a camera state based on the current transform of this vcam

    Declaration
    protected CameraState PullStateFromVirtualCamera(Vector3 worldUp, ref LensSettings lens)
    Parameters
    Type Name Description
    Vector3 worldUp

    Current World Up direction, as provided by the brain

    LensSettings lens

    Lens settings to serve as base, will be combined with lens from brain, if any

    Returns
    Type Description
    CameraState

    The cameraState pulled from the Camera

    RemoveExtension(CinemachineExtension)

    Remove a Pipeline stage hook callback.

    Declaration
    public virtual void RemoveExtension(CinemachineExtension extension)
    Parameters
    Type Name Description
    CinemachineExtension extension

    The extension to remove.

    ResolveFollow(Transform)

    Returns this vcam's Follow target, or if that is null, will retrun the parent vcam's Follow target.

    Declaration
    public Transform ResolveFollow(Transform localFollow)
    Parameters
    Type Name Description
    Transform localFollow

    This vcam's Follow value.

    Returns
    Type Description
    Transform

    The same value, or the parent's if null and a parent exists.

    ResolveLookAt(Transform)

    Returns this vcam's LookAt target, or if that is null, will retrun the parent vcam's LookAt target.

    Declaration
    public Transform ResolveLookAt(Transform localLookAt)
    Parameters
    Type Name Description
    Transform localLookAt

    This vcam's LookAt value.

    Returns
    Type Description
    Transform

    The same value, or the parent's if null and a parent exists.

    Start()

    Derived classes should call base class implementation.

    Declaration
    protected virtual void Start()

    Update()

    Base class implementation makes sure the priority queue remains up-to-date.

    Declaration
    protected virtual void Update()

    UpdateCameraState(Vector3, float)

    Update the camera's state. The implementation must guarantee against multiple calls per frame, and should use CinemachineCore.UpdateVirtualCamera(ICinemachineCamera, Vector3, float), which has protection against multiple calls per frame.

    Declaration
    public void UpdateCameraState(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 0)

    UpdateTargetCache()

    Call this from InternalUpdateCameraState() to check for changed targets and update the target cache. This is needed for tracking when a target object changes.

    Declaration
    protected void UpdateTargetCache()

    Implements

    ICinemachineCamera
    ISerializationCallbackReceiver
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)