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.
Implements
Inherited Members
Namespace: Unity.Cinemachine.Editor
Assembly: solution.dll
Syntax
public abstract class CinemachineTool : EditorTool, IDrawSelectedHandles
Properties
Name | Description |
---|---|
toolbar |
This lets the editor find the icon of the tool. |
Methods
Name | Description |
---|---|
Get |
Implement this to set your Tool's icon and tooltip. |
Is |
This checks whether this tool should be displayed or not. |
On |
This is called when the Tool is selected in the editor. |
On |
Implement IDrawSelectedHandles to draw gizmos for this tool even if it is not the active tool. |
On |
This is called when the Tool is deselected in the editor. |