Class CinemachineBrain | Cinemachine | 2.5.0
docs.unity3d.com
    Show / Hide Table of Contents

    Class CinemachineBrain

    CinemachineBrain is the link between the Unity Camera and the Cinemachine Virtual Cameras in the scene. It monitors the priority stack to choose the current Virtual Camera, and blend with another if necessary. Finally and most importantly, it applies the Virtual Camera state to the attached Unity Camera.

    The CinemachineBrain is also the place where rules for blending between virtual cameras are defined. Camera blending is an interpolation over time of one virtual camera position and state to another. If you think of virtual cameras as cameramen, then blending is a little like one cameraman smoothly passing the camera to another cameraman. You can specify the time over which to blend, as well as the blend curve shape. Note that a camera cut is just a zero-time blend.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    CinemachineBrain
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    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
    Component.rigidbody
    Component.rigidbody2D
    Component.camera
    Component.light
    Component.animation
    Component.constantForce
    Component.renderer
    Component.audio
    Component.networkView
    Component.collider
    Component.collider2D
    Component.hingeJoint
    Component.particleSystem
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    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, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, Boolean)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
    Object.FindObjectOfType<T>()
    UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindObjectOfType(Type, Boolean)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: Cinemachine
    Syntax
    [DocumentationSorting(DocumentationSortingAttribute.Level.UserRef)]
    [DisallowMultipleComponent]
    [ExecuteInEditMode]
    [AddComponentMenu("Cinemachine/CinemachineBrain")]
    public class CinemachineBrain : MonoBehaviour

    Fields

    m_BlendUpdateMethod

    The update time for the Brain, i.e. when the blends are evaluated and the brain's transform is updated.

    Declaration
    [Tooltip("The update time for the Brain, i.e. when the blends are evaluated and the brain's transform is updated")]
    public CinemachineBrain.BrainUpdateMethod m_BlendUpdateMethod
    Field Value
    Type Description
    CinemachineBrain.BrainUpdateMethod

    m_CameraActivatedEvent

    This event will fire whenever a virtual camera goes live. If a blend is involved, then the event will fire on the first frame of the blend

    Declaration
    [Tooltip("This event will fire whenever a virtual camera goes live.  If a blend is involved, then the event will fire on the first frame of the blend.")]
    public CinemachineBrain.VcamActivatedEvent m_CameraActivatedEvent
    Field Value
    Type Description
    CinemachineBrain.VcamActivatedEvent

    m_CameraCutEvent

    This event will fire whenever a virtual camera goes live and there is no blend

    Declaration
    [Tooltip("This event will fire whenever a virtual camera goes live and there is no blend")]
    public CinemachineBrain.BrainEvent m_CameraCutEvent
    Field Value
    Type Description
    CinemachineBrain.BrainEvent

    m_CustomBlends

    This is the asset which contains custom settings for specific blends.

    Declaration
    [Tooltip("This is the asset that contains custom settings for blends between specific virtual cameras in your scene")]
    public CinemachineBlenderSettings m_CustomBlends
    Field Value
    Type Description
    CinemachineBlenderSettings

    m_DefaultBlend

    The blend which is used if you don't explicitly define a blend between two Virtual Cameras.

    Declaration
    [Tooltip("The blend that is used in cases where you haven't explicitly defined a blend between two Virtual Cameras")]
    public CinemachineBlendDefinition m_DefaultBlend
    Field Value
    Type Description
    CinemachineBlendDefinition

    m_IgnoreTimeScale

    When enabled, the cameras will always respond in real-time to user input and damping, even if the game is running in slow motion

    Declaration
    [Tooltip("When enabled, the cameras will always respond in real-time to user input and damping, even if the game is running in slow motion")]
    public bool m_IgnoreTimeScale
    Field Value
    Type Description
    Boolean

    m_ShowCameraFrustum

    When enabled, shows the camera's frustum in the scene view.

    Declaration
    [Tooltip("When enabled, the camera's frustum will be shown at all times in the scene view")]
    public bool m_ShowCameraFrustum
    Field Value
    Type Description
    Boolean

    m_ShowDebugText

    When enabled, the current camera and blend will be indicated in the game window, for debugging.

    Declaration
    [Tooltip("When enabled, the current camera and blend will be indicated in the game window, for debugging")]
    public bool m_ShowDebugText
    Field Value
    Type Description
    Boolean

    m_UpdateMethod

    Depending on how the target objects are animated, adjust the update method to minimize the potential jitter. Use FixedUpdate if all your targets are animated with for RigidBody animation. SmartUpdate will choose the best method for each virtual camera, depending on how the target is animated.

    Declaration
    [Tooltip("The update time for the vcams.  Use FixedUpdate if all your targets are animated during FixedUpdate (e.g. RigidBodies), LateUpdate if all your targets are animated during the normal Update loop, and SmartUpdate if you want Cinemachine to do the appropriate thing on a per-target basis.  SmartUpdate is the recommended setting")]
    public CinemachineBrain.UpdateMethod m_UpdateMethod
    Field Value
    Type Description
    CinemachineBrain.UpdateMethod

    m_WorldUpOverride

    If set, this object's Y axis will define the worldspace Up vector for all the virtual cameras. This is useful in top-down game environments. If not set, Up is worldspace Y.

    Declaration
    [Tooltip("If set, this object's Y axis will define the worldspace Up vector for all the virtual cameras.  This is useful for instance in top-down game environments.  If not set, Up is worldspace Y.  Setting this appropriately is important, because Virtual Cameras don't like looking straight up or straight down.")]
    public Transform m_WorldUpOverride
    Field Value
    Type Description
    Transform

    Properties

    ActiveBlend

    Get the current blend in progress. Returns null if none.

    Declaration
    public CinemachineBlend ActiveBlend { get; }
    Property Value
    Type Description
    CinemachineBlend

    ActiveVirtualCamera

    Get the current active virtual camera.

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

    CurrentCameraState

    The current state applied to the unity camera (may be the result of a blend)

    Declaration
    public CameraState CurrentCameraState { get; }
    Property Value
    Type Description
    CameraState

    DefaultWorldUp

    Get the default world up for the virtual cameras.

    Declaration
    public Vector3 DefaultWorldUp { get; }
    Property Value
    Type Description
    Vector3

    IsBlending

    Is there a blend in progress?

    Declaration
    public bool IsBlending { get; }
    Property Value
    Type Description
    Boolean

    OutputCamera

    Get the Unity Camera that is attached to this GameObject. This is the camera that will be controlled by the brain.

    Declaration
    public Camera OutputCamera { get; }
    Property Value
    Type Description
    Camera

    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

    Methods

    GetSoloGUIColor()

    API for the Unity Editor.

    Declaration
    public static Color GetSoloGUIColor()
    Returns
    Type Description
    Color

    Color used to indicate that a camera is in Solo mode.

    IsLive(ICinemachineCamera, Boolean)

    True if the ICinemachineCamera the current active camera, or part of a current blend, either directly or indirectly because its parents are live.

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

    The camera to test whether it is live

    Boolean dominantChildOnly

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

    Returns
    Type Description
    Boolean

    True if the camera is live (directly or indirectly) or part of a blend in progress.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023