Description
The CurrentSubTool
property of the EditorToolManager
class provides access to the currently active sub-tool within the editor environment. This property is an instance of Editor.EditorTool
and allows developers to retrieve or set the sub-tool that is currently in use. The sub-tool is a more specific tool that operates under the context of a broader tool, represented by the CurrentTool
property.
Usage
To use the CurrentSubTool
property, you can directly access it from an instance of EditorToolManager
. This property can be both read and modified, allowing you to check which sub-tool is currently active or to set a new sub-tool as needed.
Example usage:
// Access the current sub-tool
Editor.EditorTool currentSubTool = editorToolManager.CurrentSubTool;
// Set a new sub-tool
editorToolManager.CurrentSubTool = newSubToolInstance;
Example
// Example of accessing and setting the CurrentSubTool property
// Assume editorToolManager is an instance of EditorToolManager
Editor.EditorTool currentSubTool = editorToolManager.CurrentSubTool;
// Output the name of the current sub-tool
string subToolName = currentSubTool?.Name ?? "No sub-tool active";
// Set a new sub-tool
Editor.EditorTool newSubTool = new Editor.EditorTool();
editorToolManager.CurrentSubTool = newSubTool;
// Verify the change
if (editorToolManager.CurrentSubTool == newSubTool)
{
// Successfully set the new sub-tool
}