Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SetActiveTool

Sets the active EditorTool.
Read time 2 minutesLast updated 6 days ago

Definition

SetActiveTool<T>()

Sets the active EditorTool.
public static void SetActiveTool<T>() where T : EditorTool

Remarks

To set a built-in tool, such as Move, Rotate, or Scale, to active, use Tools.current instead.

Examples

using UnityEditor;using UnityEditor.EditorTools;using UnityEngine;class ToolToSetActive : EditorTool{ [MenuItem("Tools/Set Active Tool Type")] static void SetActiveToolExample() { ToolManager.SetActiveTool<ToolToSetActive>(); } Vector3 m_Position; public override void OnToolGUI(EditorWindow window) { m_Position = Handles.PositionHandle(m_Position, Quaternion.identity); Debug.Log(m_Position); }}

SetActiveTool(Type)

Sets the active EditorTool.
public static void SetActiveTool(Type type)

Parameters

type

The EditorTool type to set as the active tool.

Remarks

To set a built-in tool, such as Move, Rotate, or Scale, to active, use Tools.current instead.

Examples

using UnityEditor;using UnityEditor.EditorTools;using UnityEngine;class ToolToSetActive : EditorTool{ [MenuItem("Tools/Set Active Tool Type")] static void SetActiveToolExample() { ToolManager.SetActiveTool<ToolToSetActive>(); } Vector3 m_Position; public override void OnToolGUI(EditorWindow window) { m_Position = Handles.PositionHandle(m_Position, Quaternion.identity); Debug.Log(m_Position); }}

SetActiveTool(EditorTool)

Sets the active EditorTool.
public static void SetActiveTool(EditorTool tool)

Parameters

The EditorTool instance to set as the active tool.

Remarks

To set a built-in tool, such as Move, Rotate, or Scale, to active, use Tools.current instead.

Examples

using UnityEditor;using UnityEditor.EditorTools;using UnityEngine;class ToolToSetActive : EditorTool{ [MenuItem("Tools/Set Active Tool Type")] static void SetActiveToolExample() { ToolManager.SetActiveTool<ToolToSetActive>(); } Vector3 m_Position; public override void OnToolGUI(EditorWindow window) { m_Position = Handles.PositionHandle(m_Position, Quaternion.identity); Debug.Log(m_Position); }}