Version: Unity 6.3 Beta (6000.3)
LanguageEnglish
  • C#

ToolAttribute.group

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public Type group;

Description

Tool groups place logically similar tools under a single header in the Tools Overlay.

Use Tool groups when tools that have different ToolAttribute.targetType need to stay together in the Tools Overlay. Otherwise, they're grouped by their scope: built-in, additional built-in, global, and component.

using UnityEngine;
using UnityEditor.EditorTools;

namespace ToolGroupsExample
{
    // Group A
    [Icon("Assets/ToolGroupA.png")]
    public class ToolGroup_A {}

    [EditorTool("Tool A (Group A)", typeof(Transform), group = typeof(ToolGroup_A))]
    public class ToolA_GroupA : EditorTool {}

    [EditorTool("Tool B (Group A)", typeof(BoxCollider), group = typeof(ToolGroup_A))]
    public class ToolB_GroupA : EditorTool {}

    // Group B
    [Icon("Assets/ToolGroupB.png")]
    public class ToolGroup_B {}

    [EditorTool("Tool A (Group B)", typeof(MeshRenderer), group = typeof(ToolGroup_B))]
    public class ToolA_GroupB : EditorTool {}

    [EditorTool("Tool B (Group B)", typeof(SphereCollider), group = typeof(ToolGroup_B))]
    public class ToolB_GroupB : EditorTool {}

    // Global
    [EditorTool("Tool C (Global - Ungrouped)")]
    public class ToolC_Global : EditorTool {}

    // Component
    [EditorTool("Tool D (Component - Ungrouped)", typeof(Transform))]
    public class ToolD_Ungrouped : EditorTool {}
}