Version: 2021.2
言語: 日本語

Overlay

class in UnityEditor.Overlays

マニュアルに切り替える

説明

Overlays are persistent and customizable panels and toolbars that are available within Editor Windows. Use Overlays to expose actions and tool options in a convenient and user-controllable way.

This is the base class from which all Overlays inherit. To create an Overlay, return a UnityEngine.UIElements.VisualElement.

using UnityEditor;
using UnityEditor.Overlays;
using UnityEngine.UIElements;

[Overlay(typeof(SceneView), "Selection Count")]
class SelectionCount : Overlay
{
    Label m_Label;

    public override VisualElement CreatePanelContent()
    {
        Selection.selectionChanged += () =>
        {
            if (m_Label != null)
                m_Label.text = $"Selection Count {Selection.count}";
        };

        return m_Label = new Label($"Selection Count {Selection.count}");
    }
}

To create an Overlay that is dockable in a toolbar, see ToolbarOverlay.

Static 変数

ussClassNameUSS class name of elements of this type.

変数

collapsedDefines whether the overlay is in collapsed form.
containerWindowEditorWindow the overlay is contained within.
displayedShows or hides the overlay.
displayNameName of overlay used as title.
floatingReturns true if overlay is floating, returns false if overlay is docked in a corner or in a toolbar.
floatingPositionLocal position of closest overlay corner to closest dockposition when floating.
idOverlay unique ID.
isInToolbarReturns true if overlay is docked in a toolbar.
layoutDescribes the presentation mode for an Overlay.

Public 関数

CreatePanelContentImplement this method to return your visual element content.
OnCreatedOnCreated is invoked when an Overlay is instantiated in an Overlay Canvas.
OnWillBeDestroyedCalled when an Overlay is about to be destroyed.
UndockIf this Overlay is currently in a toolbar, it will be removed and return to a floating state.

Events

collapsedChangedInvoked when Overlay.collapsed value is changed.
displayedChangedThis callback is invoked when the Overlay.displayed value has been changed.
floatingChangedCalled when the value of floating has changed.
floatingPositionChangedThis event is invoked when Overlay.floatingPosition is changed.
layoutChangedSubscribe to this event to be notified when the Overlay.Layout property is modified.