Table of Contents

Class Overlay

Namespace
UILib
Assembly
UILib.dll

A primitive UIObject which stays in a fixed position on the screen.

public class Overlay : UIObject
Inheritance
Overlay
Derived
Inherited Members

Constructors

Overlay(float, float)

Initializes an overlay.

By default overlays will pause the game when shown. If you want to disable this behaviour see SetLockMode(LockMode).

public Overlay(float width, float height)

Parameters

width float

The width of the overlay

height float

The height of the overlay

Properties

canvas

This overlay's canvas.

public Canvas canvas { get; }

Property Value

Canvas

enabled

Whether the user can interact with this overlay.

public bool enabled { get; }

Property Value

bool

isFocused

Whether this overlay is currently focused. If the overlay is focused, it means that it can receive local shortcuts.

public bool isFocused { get; }

Property Value

bool

lockMode

The lock modes this overlay will automatically use when it's visible.

public LockMode lockMode { get; }

Property Value

LockMode

onFocus

Invokes listeners when this overlay becomes focused.

public UnityEvent onFocus { get; }

Property Value

UnityEvent

onLostFocus

Invokes listeners when this overlay loses focus.

public UnityEvent onLostFocus { get; }

Property Value

UnityEvent

sortingMode

The sorting mode this overlay is currently in.

public Overlay.SortingMode sortingMode { get; }

Property Value

Overlay.SortingMode

Methods

AddShortcut(Shortcut)

Adds a local Shortcut to this overlay.

Local shortcuts are triggered whenever all keys configured in the shortcut are pressed.

Local shortcuts only trigger when the Overlay they're added to is currently in focus.

public void AddShortcut(Shortcut shortcut)

Parameters

shortcut Shortcut

The shortcut to add

BringToFront()

Brings this overlay to the front so that it displays above all others.

If the sorting mode is Recede, this will only cause the overlay to become focused. It won't move to the front.

public void BringToFront()

Destroy()

Destroy this overlay and all children.

public override void Destroy()

Disable()

Disables interacting with this overlay.

public virtual void Disable()

Enable()

Enables interacting with this overlay.

public virtual void Enable()

Hide()

Hides this overlay and closes the internal Lock.

public override void Hide()

OnClick()

Bring this overlay's canvas to the front.

protected override void OnClick()

OnPointerEnter()

Handles this overlay being hovered over.

protected override void OnPointerEnter()

OnPointerExit()

Handles this overlay no longer being hovered over.

protected override void OnPointerExit()

SetLockMode(LockMode)

Sets the lock mode this overlay will use when it's visible.

If the overlay is currently visible, the provided lock mode will apply immediately.

public void SetLockMode(LockMode lockMode)

Parameters

lockMode LockMode

The lock mode to use

SetSortingMode(SortingMode)

Sets the sorting mode this overlay is currently in

public void SetSortingMode(Overlay.SortingMode sortingMode)

Parameters

sortingMode Overlay.SortingMode

The new sorting mode to use

SetThisTheme(Theme)

Allows setting the theme of this overlay.

This handles setting the theme specifically for this object, not its children. It's protected to allow overriding if you were to create a subclass.

In most cases, you'd probably want to use SetTheme(Theme) instead.

protected override void SetThisTheme(Theme theme)

Parameters

theme Theme

The theme to apply

Show()

Makes this overlay visible and creates a new Lock with the current lockMode.

public override void Show()

ToggleVisibility()

Toggles the visibility of this overlay.

public override void ToggleVisibility()