Version: 2021.3
Language : English
Gizmos menu
The Game view

Custom Editor tools

You can create Editor tools with the EditorTool API.

An Editor tool’s context determines what that tool affects in the Editor. Tools can be either global tools or component tools.

Access Editor tools in the Scene viewAn interactive view into the world you are creating. You use the Scene View to select and position scenery, characters, cameras, lights, and all other types of Game Object. More info
See in Glossary
from these overlays:

  • The Tools overlay
  • The Tools Settings overlay

Tool context

The EditorToolContext API changes what the Editor’s built-in Transform tools affect.

The default tool context is GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
. A tool with the GameObject tool context affects the Transform values of a GameObject. Other contexts can affect different elements. For example, the Spline tool context makes it so the Move, Rotate, and Scale tools affect Spline knots and tangents.

If your project contains multiple tool contexts, you can use the first button in the Tools overlay to select a tool context. If the tool context button isn’t selected, then the default GameObject tool context is active. The tool context button isn’t available from the Tools overlay if there are no extra tool contexts in your project.

Global tools vs. component tools

Tools you create with the EditorTool API can either be global or component tools.

Global tools

A global tool affects any GameObject.

A global tool is always available regardless of the type of GameObject you select. For example, you can always access a Transform tool because the Transform tool works with any GameObject.

The Tools overlay displays global tools in the section after the built-in Transform tools, such as Move, Rotate, Scale, and Rect.

Component tools

A component tool affects a specific componentA functional part of a GameObject. A GameObject can contain any number of components. Unity has many built-in components, and you can create your own by writing scripts that inherit from MonoBehaviour. More info
See in Glossary
.

A component tool is only available when you select a GameObject with the component the tool comes from attached to it. For example, you can only use a custom manipulator tool for lights when you select a GameObject with a Light component.

The last buttons in the Tools overlay are component tools. Component tools are divided into groups based on their component. The availability of component tools depends on what you have actively selected in the SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
view or Hierarchy window.

Additional resources

Gizmos menu
The Game view
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961