Implementation references

An overview of implementation references.

Scripting API
Overlays
This is the base class from which all Overlays inherit.

Overlays · UX essentials

Top guidance about using overlays in the scene view.

Use shortcuts for "Open Overlays Menu" and "Toggle Overlays"
Blue plus sign icon indicating that clicking on this will expand this content
Use the presets to save and reset your overlays
Blue plus sign icon indicating that clicking on this will expand this content
Right-clicking on an overlay header lets you see overlay options
Blue plus sign icon indicating that clicking on this will expand this content

Resources and API documentation

Overview

Scene view showing various tool overlays, including custom ProBuilder controls docking the corner.
Scene view showing various tool overlays, including custom ProBuilder controls docking the corner

Overlays can be used to display edit modes, tools, and tool settings on top of the windows they are used in, such as scene tools in the scene view window.

They are displayed as floating translucent containers that allow users to access contextual controls while maintaining background visibility.

  • Overlays are floating containers that can be implemented in any window in the scene view
  • Overlays give windows an additional layer of tools, modes, or actions
  • Overlays improve UI consistency and ease of use by making contextual actions conveniently available

Overlay examples

Overlays can be found on / used with;

  • Scene transform tools
  • View modes
  • Grid and snap options
  • Scene tool settings
  • Particle system (transient)
  • Main camera (transient)
  • ProBuilder (Package)

Anatomy

A Scene window with numbered annotations showing the various overlay elements.
Elements of overlays in the scene window

The various elements of overlays include:

  1. Overlay container: A container that holds the overlay header and contents
  2. Toolbar overlay container: These containers provide a base for overlays that can be docked in horizontal or vertical edges
  3. Dragger: Icon in overlay headers that allows dragging
  4. Overlay label: Name of overlay used as title
  5. Overlay icon (optional): Overlay icon that will be displayed in horizontal and vertical layouts
  6. Overlay content: The control elements within overlays
  7. Overlay menu: The contextual menu that shows overlay options
  8. Drop zones: Drop zones are blue areas that appear as a container is being dragged to highlight where the container can be docked, and where the container was moved from

    For more information go to drop zone color overlays ->

Overlay content

The controls that can be placed in overlays are the same as their equivalent in UI Toolkitbut inherit some overlay functionalities (like collapse state, orientation, and panel).

These elements require specific styling, so it is recommended they inherit one of the predefined EditorToolbartypes, such as:

  1. EditorToolbarButton
  2. EditorToolbarDropdown
  3. EditorToolbarDropdownToggle
  4. EditorToolbarToggle

For information about how to style overlay content go to the Unity manual  ->

Positioning and docking

Annotated example of the various docking positions for an overlay container.
Overlay container docking positions

Overlays can float freely or be dragged to dock on the edges or corner of their parent windows. A container’s position is adjusted by using the dragger.

  1. Floating: Overlay containers can float anywhere on their parent window. Floating containers can be displayed in any layout mode.
  2. Edge docking: Overlay containers can be docked on the edges of their parent window where the edge drop zones appear when dragging. Once docked, they are displayed in horizontal or vertical layout mode in a toolbar overlay container along the edge.
  3. Corner docking: Overlay containers can be docked in the corner of their parent windows where the corner drop zones appear when dragging. Corner docked containers can be displayed in any layout mode.

Layout modes

Annotated elements of different overlay layout modes as displayed in the Scene view.
Different overlay layout modes displayed in scene view

Overlays can be set to display in different layouts:

  1. Collapsed: A minimized overlay container that displays the icon (or first two letters of an overlay label), and a dropdown button to expand the overlay
  2. Panel: The standard overlay container that show the dragger, overlay label, and all of its content
  3. Vertical: A vertical overlay container that shows the dragger and overlay content
  4. Horizontal: A horizontal overlay container that shows the dragger and overlay content
  5. Horizontal toolbar: Overlays that are docked on the edges of the window appear in toolbars

Collapsed overlays when edge docking

When horizontal and vertical layouts are not defined for an overlay, it will collapse when docked on the edges of its window.

Collapsed overlay labels

Collapsed tools overlay on the left and a collapsed particles overlay to on the right.
Collapsed tools overlay on the left and a collapsed particles overlay on the right.
  1. When an overlay is collapsed, its label will be replaced by its icon
  2. If no icon is specified, by default the system uses the first two letters of the overlay name (or the first two initial letters of the first two words)

Style

Drop zones

Annotated illustration showing the target dropzone on the left and the ghost dropzone n the right
1. Target dropzone, showing where the container can be docked  2. Ghost dropzone, showing where the container currently is

Drop zones are blue areas that appear as a container is being dragged to highlight where the container can be docked and where the container was before.

  1. Target drop zone: While dragging a container, the target drop zone shows where the container can be docked by highlighting the target area
  2. Ghost drop zone: While dragging a docked container, the ghost drop zone shows where the container currently is by highlighting the shape of the container in its current location
Annotated illustration showing the three dropzone locations: corner, edge, and toolbar docking
Drop zone locations: 1. corner 2. edge and 3. toolbar docking

The shapes of target and ghost drop zones are displayed differently depending on the location of the overlay container / target.

  1. Corner drop zone: Corner drop zones are used to highlight corners of the window where a container can be docked; they appear as a square blue layer in the corner of the container the overlay is being dragged into
  2. Edge drop zone: Edge drop zones are used to highlight edges of the window where a container can be docked. they appear as a thin blue layer along the edge of the container the overlay is being dragged into
  3. Toolbar drop zone: When a container is being dragged into a toolbar, the position of the target is highlighted within it

For more information go to drop zone color variables ->

Behavior

Overlay menus

Examples of the overlay menu and the overlay settings menu
An overlay menu is accessed by right-clicking on its header (left); the overlay settings menu is opened by “space” shortcut (right)

Most overlay actions are done in the overlay menu. This menu can be accessed in two ways:

  1. Tab well menu (..)
  2. Right-click context menu

Transient state

Animated example of two transient overlays
Examples of transient overlays; the main camera and particle system overlays are displayed after selecting their elements

Transient overlays are a type of overlay that is not controlled by a user, and only drawn in the active scene view when requested by the visible property.

For more information about transient states go to Unity Scripting References ->

Color variables

Container color
Container background
Background color and opacity of containers
#B6B6B6
%90
#000000 %80
Dragger color
White
Primarily for icons that need to change color on a selected state.
#F0F0F0
#F0F0F0
Drop zone colors
Ghost drop zone
Highlight that shows where the container currently is
#00aaef %25
#00aaef %25
Ghost on hover
Ghost drop zone when element is hovered on it
#00aaef %50
#00aaef %50
Target drop zone
Highlight that shows where the container can be docked
#00aaef %25
#00aaef %25

Creating custom overlays

You can create custom panel overlays and toolbar overlays for your scene view window.

For a step-by-step guide on creating custom overlays go to the Unity Manual ->

Manual and code samples

Resources

Kits, tools, libraries, and documentation to guide users through creating for the Editor.