docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class CinemachineTool

    This is a generic Tool class for Cinemachine tools. To create a new tool, inherit from CinemachineTool and implement GetIcon(). Your new tool will need to have the [EditorTool("tool-name", typeof(CinemachineVirtualCameraBase))] attribute.

    A tool will be drawn iff it has been registered using CinemachineSceneToolUtility.RegisterTool. This is generally done in the OnEnable function of the editor script of the cinemachine component (CinemachineVirtualCamera, CinemachineComponentBase), for which the tool was meant. To unregister, call CinemachineSceneToolUtility.UnregisterTool in the same script's OnDisable function.

    To draw the handles related to the tool, you need to implement your drawing function and call it in the editor script's OnSceneGUI function. An alternative for drawing handles is to override this function's OnToolGUI or OnDrawHandles functions (see EditorTool or IDrawSelectedHandles docs for more information).

    To check, if a tool has been enabled/disabled in the editor script, use CinemachineSceneToolUtility.IsToolActive.

    Inheritance
    object
    Object
    ScriptableObject
    EditorTool
    CinemachineTool
    Implements
    IDrawSelectedHandles
    Inherited Members
    EditorTool.OnToolGUI(EditorWindow)
    EditorTool.targets
    EditorTool.target
    EditorTool.gridSnapEnabled
    ScriptableObject.SetDirty()
    ScriptableObject.CreateInstance(string)
    ScriptableObject.CreateInstance(Type)
    ScriptableObject.CreateInstance<T>()
    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.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    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.FindObjectsOfTypeAll(Type)
    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: Unity.Cinemachine.Editor
    Assembly: Unity.Cinemachine.Editor.dll
    Syntax
    public abstract class CinemachineTool : EditorTool, IDrawSelectedHandles

    Properties

    toolbarIcon

    This lets the editor find the icon of the tool.

    Declaration
    public override GUIContent toolbarIcon { get; }
    Property Value
    Type Description
    GUIContent
    Overrides
    EditorTool.toolbarIcon

    Methods

    GetIcon()

    Implement this to set your Tool's icon and tooltip.

    Declaration
    protected abstract GUIContent GetIcon()
    Returns
    Type Description
    GUIContent

    A GUIContent with an icon set.

    IsAvailable()

    This checks whether this tool should be displayed or not.

    Declaration
    public override bool IsAvailable()
    Returns
    Type Description
    bool

    True, when this tool is to be drawn. False, otherwise.

    Overrides
    EditorTool.IsAvailable()

    OnActivated()

    This is called when the Tool is selected in the editor.

    Declaration
    public override void OnActivated()
    Overrides
    EditorTool.OnActivated()

    OnDrawHandles()

    Implement IDrawSelectedHandles to draw gizmos for this tool even if it is not the active tool.

    Declaration
    public void OnDrawHandles()

    OnWillBeDeactivated()

    This is called when the Tool is deselected in the editor.

    Declaration
    public override void OnWillBeDeactivated()
    Overrides
    EditorTool.OnWillBeDeactivated()

    Implements

    IDrawSelectedHandles
    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)