Class LayoutRoot
Entry point to create layouts
public class LayoutRoot
- Inheritance
-
LayoutRoot
- Inherited Members
Constructors
LayoutRoot(bool, string)
Creates a new layout root
public LayoutRoot(bool persist, string name = "New LayoutRoot")
Parameters
persist
boolWhether the layout will persist across scene transitions
name
stringThe name of the layout root and underlying canvas
Properties
Canvas
The unity Canvas underlying the layout.
public GameObject Canvas { get; }
Property Value
- GameObject
Elements
A read-only collection of elements registered to this layout.
public IEnumerable<ArrangableElement> Elements { get; }
Property Value
Interactive
Whether the elements in this layout hierarchy should be interactive. When true (by default), the elements in the hierarchy will block interaction with other UI elements.
public bool Interactive { get; set; }
Property Value
IsPersistent
Whether this is a persistent layout
public bool IsPersistent { get; }
Property Value
Name
The name of the layout root
public string Name { get; }
Property Value
Opacity
The current opacity of elements in the layout hierarchy.
public float Opacity { get; set; }
Property Value
RenderDebugLayoutBounds
Whether to render the layout system bounds of elements in this layout for debugging purposes
public bool RenderDebugLayoutBounds { get; set; }
Property Value
VisibilityCondition
A predicate that determines whether the layout should be visible. By default (i.e. when there is no condition), the layout is always visible.
public Func<bool>? VisibilityCondition { get; set; }
Property Value
Methods
BeginFade(float, float)
Linearly fades the elements in this layout hierarchy to a new opacity value.
public void BeginFade(float targetOpacity, float fadeDuration)
Parameters
targetOpacity
floatThe target opacity.
fadeDuration
floatThe duration of time the fade should take to complete, in seconds.
Destroy()
Destroys the layout root and all of its child elements
public void Destroy()
ForceInteractivityRefresh()
Forces the interactivity controller to immediately re-evaluate interactivity conditions without needing to wait a frame
public void ForceInteractivityRefresh()
GetElement(string)
Gets an element in this layout by name
public ArrangableElement? GetElement(string name)
Parameters
name
stringThe name to search for
Returns
- ArrangableElement
The first element in this layout with the given name if any exist, or else null
GetElement<T>(string)
Gets an element in this layout by name and type
public T? GetElement<T>(string name) where T : ArrangableElement
Parameters
name
stringThe name to search for
Returns
- T
The first element in this layout with the given name and type if any exist, or else null
Type Parameters
T
The type of element to search for
GetElements(string)
Gets all elements in this layout by name
public IEnumerable<ArrangableElement> GetElements(string name)
Parameters
name
stringThe name to search for
Returns
- IEnumerable<ArrangableElement>
All elements in this layout with the given name if any exist, or else an empty enumerable
GetElements<T>(string)
Gets all elements in this layout by name and type
public IEnumerable<T> GetElements<T>(string name) where T : ArrangableElement
Parameters
name
stringThe name to search for
Returns
- IEnumerable<T>
All elements in this layout with the given name and type if any exist, or else an empty enumerable
Type Parameters
T
The type of element to search for
ListenForHotkey(KeyCode, Action, ModifierKeys, Func<bool>?)
Initializes a hotkey listener that performs an action when a given key combination is pressed
public void ListenForHotkey(KeyCode key, Action execute, ModifierKeys modifiers = ModifierKeys.None, Func<bool>? condition = null)
Parameters
key
KeyCodeThe keypress to listen for
execute
ActionThe action to perform when the key is pressed
modifiers
ModifierKeysOther required modifier keys that must be held to trigger the event
condition
Func<bool>The condition in which this hotkey should be enabled
ListenForPlayerAction(PlayerAction, Action, Func<bool>?)
Initializes a PlayerAction listener that performs an action when the PlayerAction IsPressed goes from False to True
public void ListenForPlayerAction(PlayerAction playerAction, Action execute, Func<bool>? condition = null)