# EditorToolAttribute

> Registers an EditorTool as either a Global tool or a CustomEditor tool.

## Definition

* **Type:** Constructor
* **Namespace:** [UnityEditor.EditorTools](/engine/6000.5/script-reference/unityeditor/editortools.md)
* **Assembly:** UnityEditor.CoreModule

## EditorToolAttribute(string, Type)

Registers an [EditorTool](/engine/6000.5/script-reference/unityeditor/editortools/editortool.md) as either a Global tool or a [CustomEditor](/engine/6000.5/script-reference/unityeditor/customeditor.md) tool.

```csharp
public EditorToolAttribute(string displayName, Type componentToolTarget = null)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name to display in menus.**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): The type this tool can edit. Set to null if the tool is not a [Component](/engine/6000.5/script-reference/unityengine/component.md) tool.

### Remarks

A Global tool is always available in the toolbar menu. A [CustomEditor](/engine/6000.5/script-reference/unityeditor/customeditor.md) tool is only available when the current selection contains a matching target type.

## EditorToolAttribute(string, Type, Type)

Registers an [EditorTool](/engine/6000.5/script-reference/unityeditor/editortools/editortool.md) as either a Global tool or a [CustomEditor](/engine/6000.5/script-reference/unityeditor/customeditor.md) tool.

```csharp
public EditorToolAttribute(string displayName, Type componentToolTarget, Type editorToolContext)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name to display in menus.**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): The type this tool can edit. Set to null if the tool is not a [Component](/engine/6000.5/script-reference/unityengine/component.md) tool.**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): The [EditorToolContext](/engine/6000.5/script-reference/unityeditor/editortools/editortoolcontext.md) type that this tool relates to. When an [EditorTool](/engine/6000.5/script-reference/unityeditor/editortools/editortool.md) defines an `editorToolContext` scope, the tool is not shown in menus and must be activated by the [EditorToolContext.ResolveTool](/engine/6000.5/script-reference/unityeditor/editortools/editortoolcontext/resolvetool.md) method.

### Remarks

A Global tool is always available in the toolbar menu. A [CustomEditor](/engine/6000.5/script-reference/unityeditor/customeditor.md) tool is only available when the current selection contains a matching target type.

## EditorToolAttribute(string, Type, Type, Type)

Registers an [EditorTool](/engine/6000.5/script-reference/unityeditor/editortools/editortool.md) as either a Global tool or a [CustomEditor](/engine/6000.5/script-reference/unityeditor/customeditor.md) tool.

```csharp
public EditorToolAttribute(string displayName, Type componentToolTarget, Type editorToolContext, Type variantGroup)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name to display in menus.**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): The type this tool can edit. Set to null if the tool is not a [Component](/engine/6000.5/script-reference/unityengine/component.md) tool.**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): The [EditorToolContext](/engine/6000.5/script-reference/unityeditor/editortools/editortoolcontext.md) type that this tool relates to. When an [EditorTool](/engine/6000.5/script-reference/unityeditor/editortools/editortool.md) defines an `editorToolContext` scope, the tool is not shown in menus and must be activated by the [EditorToolContext.ResolveTool](/engine/6000.5/script-reference/unityeditor/editortools/editortoolcontext/resolvetool.md) method.**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): The tool variant group to assign the tool to in the Tools overlay. Tool variants are used to group similar tools into a single button in the Tools overlay. Refer to [ToolAttribute.variantGroup](/engine/6000.5/script-reference/unityeditor/editortools/toolattribute/variantgroup.md).

### Remarks

A Global tool is always available in the toolbar menu. A [CustomEditor](/engine/6000.5/script-reference/unityeditor/customeditor.md) tool is only available when the current selection contains a matching target type.

## EditorToolAttribute(string, Type, Type, int, Type)

Registers an [EditorTool](/engine/6000.5/script-reference/unityeditor/editortools/editortool.md) as either a Global tool or a [CustomEditor](/engine/6000.5/script-reference/unityeditor/customeditor.md) tool.

```csharp
public EditorToolAttribute(string displayName, Type componentToolTarget, Type editorToolContext, int toolPriority, Type variantGroup)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name to display in menus.**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): The type this tool can edit. Set to null if the tool is not a [Component](/engine/6000.5/script-reference/unityengine/component.md) tool.**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): The [EditorToolContext](/engine/6000.5/script-reference/unityeditor/editortools/editortoolcontext.md) type that this tool relates to. When an [EditorTool](/engine/6000.5/script-reference/unityeditor/editortools/editortool.md) defines an `editorToolContext` scope, the tool is not shown in menus and must be activated by the [EditorToolContext.ResolveTool](/engine/6000.5/script-reference/unityeditor/editortools/editortoolcontext/resolvetool.md) method.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The order to display tools in the Tools overlay in. Refer to [ToolAttribute.toolPriority](/engine/6000.5/script-reference/unityeditor/editortools/toolattribute/toolpriority.md).**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): The tool variant group to assign the tool to in the Tools overlay. Tool variants are used to group similar tools into a single button in the Tools overlay. Refer to [ToolAttribute.variantGroup](/engine/6000.5/script-reference/unityeditor/editortools/toolattribute/variantgroup.md).

### Remarks

A Global tool is always available in the toolbar menu. A [CustomEditor](/engine/6000.5/script-reference/unityeditor/customeditor.md) tool is only available when the current selection contains a matching target type.

## EditorToolAttribute(string, Type, Type, int, Type, int)

Registers an [EditorTool](/engine/6000.5/script-reference/unityeditor/editortools/editortool.md) as either a Global tool or a [CustomEditor](/engine/6000.5/script-reference/unityeditor/customeditor.md) tool.

```csharp
public EditorToolAttribute(string displayName, Type componentToolTarget, Type editorToolContext, int toolPriority, Type variantGroup, int variantPriority)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name to display in menus.**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): The type this tool can edit. Set to null if the tool is not a [Component](/engine/6000.5/script-reference/unityengine/component.md) tool.**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): The [EditorToolContext](/engine/6000.5/script-reference/unityeditor/editortools/editortoolcontext.md) type that this tool relates to. When an [EditorTool](/engine/6000.5/script-reference/unityeditor/editortools/editortool.md) defines an `editorToolContext` scope, the tool is not shown in menus and must be activated by the [EditorToolContext.ResolveTool](/engine/6000.5/script-reference/unityeditor/editortools/editortoolcontext/resolvetool.md) method.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The order to display tools in the Tools overlay in. Refer to [ToolAttribute.toolPriority](/engine/6000.5/script-reference/unityeditor/editortools/toolattribute/toolpriority.md).**** (\[Type]\(https\://learn.microsoft.com/dotnet/api/system.type)): The tool variant group to assign the tool to in the Tools overlay. Tool variants are used to group similar tools into a single button in the Tools overlay. Refer to [ToolAttribute.variantGroup](/engine/6000.5/script-reference/unityeditor/editortools/toolattribute/variantgroup.md).**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The variant priority defines the order that tools are displayed in when they are displayed in a [ToolAttribute.variantGroup](/engine/6000.5/script-reference/unityeditor/editortools/toolattribute/variantgroup.md) dropdown.

### Remarks

A Global tool is always available in the toolbar menu. A [CustomEditor](/engine/6000.5/script-reference/unityeditor/customeditor.md) tool is only available when the current selection contains a matching target type.
