Version: 2023.1
public Type variantGroup ;

描述

Tool variants are used to group logically similar tools into a single button in the Tools Overlay.

The variantGroup type acts a key to specify groups of tools that should be considered a group in the UI.

using System;
using UnityEditor;
using UnityEditor.EditorTools;
using UnityEngine;

struct ShapeVariantGroup {}

// Define 3 tools that should be shown as a single button in the Tools Overlay.

[EditorTool("Line", variantGroup = typeof(ShapeVariantGroup), variantPriority = 2)] [Icon("Assets/Examples/Icons/Variant-Line.png")] class Line : EditorTool {}

[EditorTool("Circle", variantGroup = typeof(ShapeVariantGroup), variantPriority = 1)] [Icon("Assets/Examples/Icons/Variant-Circle.png")] class Circle : EditorTool {}

[EditorTool("Square", variantGroup = typeof(ShapeVariantGroup), variantPriority = 0)] [Icon("Assets/Examples/Icons/Variant-Square.png")] class Square : EditorTool {}