• Studio

  • Studio API

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • Globals

    VisualElement

    Inherits from:

    Creates a new instance of VisualElement. This is the basic building block for UI elements, offering foundational features like layout, styling, and rendering. Unity's VisualElement Documentation

    Properties

    canGrabFocus

    boolean
    ClientOnly
    ReadOnly

    Indicates whether the element can capture user focus. This is useful for determining if the element is interactive. Unity's VisualElement.canGrabFocus Documentation

    childCount

    number
    ClientOnly
    ReadOnly

    The number of children of the element. Unity's VisualElement.childCount Documentation

    The content container of the element. Unity's VisualElement.contentContainer Documentation

    contentRect

    ClientOnly
    ReadOnly

    Represents the rectangular area that contains the element's content, typically used for layout calculations. Unity's VisualElement.contentRect Documentation

    enabledInHierarchy

    boolean
    ClientOnly
    ReadOnly

    Determines if the element is enabled in the hierarchy. Unity's VisualElement.enabledInHierarchy Documentation

    enabledSelf

    boolean
    ClientOnly

    Determines if the element is enabled. Unity's VisualElement.enabledSelf Documentation

    layout

    ClientOnly
    ReadOnly

    Defines the layout type of the element, which influences how it arranges its children. Unity's VisualElement.layout Documentation

    localBound

    ClientOnly
    ReadOnly

    The local bounds of the element, representing its position and size relative to its parent. Unity's VisualElement.localBound Documentation

    name

    string
    ClientOnly

    The name of the element. Unity's VisualElement.name Documentation

    parent

    ClientOnly
    ReadOnly

    The parent of the element. Unity's VisualElement.parent Documentation

    schedule

    IVisualElementScheduler
    ClientOnly
    ReadOnly

    Unity's VisualElement.schedule Documentation

    style

    IStyle
    ClientOnly
    ReadOnly

    The style of the element. Unity's VisualElement.style Documentation

    tooltip

    string
    ClientOnly

    The tooltip of the element. Unity's VisualElement.tooltip Documentation

    viewDataKey

    string
    ClientOnly

    A unique identifier for storing view-related data associated with this element. Unity's VisualElement.viewDataKey Documentation

    visible

    boolean
    ClientOnly

    Determines if the element is visible. Unity's VisualElement.visible Documentation

    worldBound

    ClientOnly
    ReadOnly

    The global (world) bounds of the element, indicating its position and size within the overall UI. Unity's VisualElement.worldBound Documentation

    worldTransform

    ClientOnly
    ReadOnly

    The world transform of the element. Unity's VisualElement.worldTransform Documentation

    Methods

    Add

    ClientOnly

    Adds a child element to this element's hierarchy, making it a part of the visual tree. Unity's VisualElement.Add Documentation

    Parameters

    Returns

    void

    AddStyleSheet

    ClientOnly

    Add a style sheet to this visual element

    Parameters

    Returns

    void

    AddToClassList

    ClientOnly

    Add a class to the class list of the element. Unity's VisualElement.AddToClassList Documentation

    Parameters

    className
    string

    Returns

    void

    BringToFront

    ClientOnly

    Bring the element to the front. Unity's VisualElement.BringToFront Documentation

    Returns

    void

    Check if the class list of the element contains a class. Unity's VisualElement.ClassListContains Documentation

    Parameters

    cls
    string

    Returns

    boolean

    Clear

    ClientOnly

    Clear all children of the element. Unity's VisualElement.Clear Documentation

    Returns

    void

    ClearClassList

    ClientOnly

    Clear the class list of the element. Unity's VisualElement.ClearClassList Documentation

    Returns

    void

    Contains

    ClientOnly

    Checks if this element includes a specified child element within its hierarchy. Unity's VisualElement.Contains Documentation

    Parameters

    Returns

    boolean

    ContainsPoint

    ClientOnly

    Check if the element contains a point. Unity's VisualElement.ContainsPoint Documentation

    Parameters

    localPoint

    Returns

    boolean

    ElementAt

    ClientOnly

    Get a child at a specific index. Unity's VisualElement.ElementAt Documentation

    Parameters

    index
    number

    Enable a class in the class list of the element. Unity's VisualElement.EnableInClassList Documentation

    Parameters

    className
    string
    enable
    boolean

    Returns

    void

    Finds the closest common ancestor shared by this element and another specified element. Unity's VisualElement.FindCommonAncestor Documentation

    Parameters

    Returns

    void

    Gets the resolved style width and height as a Vector2.

    Returns

    A Vector2 where the x value is the resolved style width and the y value is the resolved style height

    IndexOf

    ClientOnly

    Get the index of a child. Unity's VisualElement.IndexOf Documentation

    Parameters

    Returns

    number

    Insert

    ClientOnly

    Insert a child at a specific index. Unity's VisualElement.Insert Documentation

    Parameters

    index
    number

    Returns

    void

    IsDisplayed

    ClientOnly

    Returns true if the element is visible. This is the equivalent of checking if the display style is none or flex.

    Returns

    boolean

    Whether the element is currently visible.

    Mark the element as dirty for repaint. Unity's VisualElement.MarkDirtyRepaint Documentation

    Returns

    void

    Overlaps

    ClientOnly

    Check if the element overlaps with another element. Unity's VisualElement.Overlaps Documentation

    Parameters

    rectangle

    Returns

    boolean

    PlaceBehind

    ClientOnly

    Positions this element immediately behind a specified sibling element within the same parent. Unity's VisualElement.PlaceBehind Documentation

    Parameters

    Returns

    void

    PlaceInFront

    ClientOnly

    Positions this element immediately in front of a specified sibling element within the same parent. Unity's VisualElement.PlaceInFront Documentation

    Parameters

    Returns

    void

    Parameters

    name
    string
    optional
    className
    string
    optional

    Registers a callback for a Highrise gesture event or Unity UI event.

    Parameters

    type

    The event type to register for. Includes Unity UI events and Highrise gesture events. The currently supported gestures and their corresponding events are: DragGesture: DragGestureBegan, DragGestureChanged, DragGestureEnded

    action

    The callback to call when the event happens.

    phase
    optional

    Which phase the callback will be called during (Default NoTrickleDown).

    Returns

    A Callback object that can be passed to UnregisterCallback

    RegisterGesture

    ClientOnly

    Registers a gesture with a VisualElement. The VisualElement will now receive events from this gesture.

    Parameters

    gesture

    The gesture to register.

    Returns

    void

    Register an action to be called when the element is long pressed

    Parameters

    action

    The callback to call when the long press is completed

    pressEffect
    optional

    The effect to apply to this element while it is pressed. Options are animating scale (Press), animating color (Highlight) or nothing (NONE) (Default Press)

    sound
    boolean
    optional

    Whether pressing this element should play the standard Highrise long press sound effect (Default true)

    haptic
    boolean
    optional

    Whether a light haptic pulse should be triggered when the long press is completed (Default false)

    Returns

    A Callback object that can be passed to UnregisterCallback

    Register an action to be called when the element is pressed

    Parameters

    action

    The callback to call when this element is pressed

    pressEffect
    optional

    The effect to apply to this element when it is pressed. Options are animating scale (Press), animating color (Highlight) or nothing (NONE) (Default Press)

    sound
    boolean
    optional

    Whether pressing this element should play the standard Highrise button click sound effect (Default true)

    haptic
    boolean
    optional

    Whether pressing this element should trigger a light haptic pulse (Default false)

    Returns

    A Callback object that can be passed to UnregisterCallback

    Remove

    ClientOnly

    Removes a specified child element from this element's hierarchy. Unity's VisualElement.Remove Documentation

    Parameters

    Returns

    void

    RemoveAt

    ClientOnly

    Remove a child at a specific index. Unity's VisualElement.RemoveAt Documentation

    Parameters

    index
    number

    Returns

    void

    Remove a class from the class list of the element. Unity's VisualElement.RemoveFromClassList Documentation

    Parameters

    className
    string

    Returns

    void

    Detaches this element from its parent, removing it from the visual tree. Unity's VisualElement.RemoveFromHierarchy Documentation

    Returns

    void

    Add a style sheet to this visual element

    Parameters

    Returns

    void

    SendToBack

    ClientOnly

    Send the element to the back. Unity's VisualElement.SendToBack Documentation

    Returns

    void

    SetDisplay

    ClientOnly

    Hide / Show an element. This is the equivalent of setting the display style to none or flex.

    Parameters

    display
    boolean

    Whether the element should be displayed

    Returns

    void

    SetEnabled

    ClientOnly

    Set the enabled state of the element. Unity's VisualElement.SetEnabled Documentation

    Parameters

    value
    boolean

    Returns

    void

    Parameters

    comp
    (x: VisualElement, y: VisualElement) -> (number)

    Returns

    void

    Toggle a class in the class list of the element. Unity's VisualElement.ToggleInClassList Documentation

    Parameters

    className
    string

    Returns

    void

    Unregisters a callback using a Callback object.

    Parameters

    callback

    The callback object that was returned by RegisterPressCallback, RegisterLongPressCallback or RegisterCallback.

    Returns

    void

    Updated 17 days ago

    PocketWorlds Icon

    © 2025 Pocket Worlds. All rights reserved.