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
Indicates whether the element can capture user focus. This is useful for determining if the element is interactive. Unity's VisualElement.canGrabFocus Documentation
The number of children of the element. Unity's VisualElement.childCount Documentation
The content container of the element. Unity's VisualElement.contentContainer Documentation
Represents the rectangular area that contains the element's content, typically used for layout calculations. Unity's VisualElement.contentRect Documentation
Determines if the element is enabled in the hierarchy. Unity's VisualElement.enabledInHierarchy Documentation
Determines if the element is enabled. Unity's VisualElement.enabledSelf Documentation
Defines the layout type of the element, which influences how it arranges its children. Unity's VisualElement.layout Documentation
The local bounds of the element, representing its position and size relative to its parent. Unity's VisualElement.localBound Documentation
The name of the element. Unity's VisualElement.name Documentation
The parent of the element. Unity's VisualElement.parent Documentation
The style of the element. Unity's VisualElement.style Documentation
The tooltip of the element. Unity's VisualElement.tooltip Documentation
A unique identifier for storing view-related data associated with this element. Unity's VisualElement.viewDataKey Documentation
Determines if the element is visible. Unity's VisualElement.visible Documentation
The global (world) bounds of the element, indicating its position and size within the overall UI. Unity's VisualElement.worldBound Documentation
The world transform of the element. Unity's VisualElement.worldTransform Documentation
Methods
Adds a child element to this element's hierarchy, making it a part of the visual tree. Unity's VisualElement.Add Documentation
Parameters
child
Returns
Add a style sheet to this visual element
Parameters
sheet
Returns
Add a class to the class list of the element. Unity's VisualElement.AddToClassList Documentation
Parameters
className
Returns
Bring the element to the front. Unity's VisualElement.BringToFront Documentation
Returns
Check if the class list of the element contains a class. Unity's VisualElement.ClassListContains Documentation
Parameters
cls
Returns
Clear all children of the element. Unity's VisualElement.Clear Documentation
Returns
Clear the class list of the element. Unity's VisualElement.ClearClassList Documentation
Returns
Checks if this element includes a specified child element within its hierarchy. Unity's VisualElement.Contains Documentation
Parameters
child
Returns
Check if the element contains a point. Unity's VisualElement.ContainsPoint Documentation
Parameters
localPoint
Returns
Get a child at a specific index. Unity's VisualElement.ElementAt Documentation
Parameters
index
Returns
Enable a class in the class list of the element. Unity's VisualElement.EnableInClassList Documentation
Parameters
className
enable
Returns
Finds the closest common ancestor shared by this element and another specified element. Unity's VisualElement.FindCommonAncestor Documentation
Parameters
other
Returns
Focus the element. Unity's VisualElement.Focus Documentation
Returns
Returns
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
Get the index of a child. Unity's VisualElement.IndexOf Documentation
Parameters
element
Returns
Insert a child at a specific index. Unity's VisualElement.Insert Documentation
Parameters
index
element
Returns
Returns true if the element is visible. This is the equivalent of checking if the display style is none or flex.
Returns
Whether the element is currently visible.
Mark the element as dirty for repaint. Unity's VisualElement.MarkDirtyRepaint Documentation
Returns
Check if the element overlaps with another element. Unity's VisualElement.Overlaps Documentation
Parameters
rectangle
Returns
Positions this element immediately behind a specified sibling element within the same parent. Unity's VisualElement.PlaceBehind Documentation
Parameters
sibling
Returns
Positions this element immediately in front of a specified sibling element within the same parent. Unity's VisualElement.PlaceInFront Documentation
Parameters
sibling
Returns
Parameters
name
className
Returns
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
Which phase the callback will be called during (Default NoTrickleDown).
Returns
A Callback object that can be passed to UnregisterCallback
Registers a gesture with a VisualElement. The VisualElement will now receive events from this gesture.
Parameters
gesture
The gesture to register.
Returns
Register an action to be called when the element is long pressed
Parameters
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
Whether pressing this element should play the standard Highrise long press sound effect (Default true)
haptic
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
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
Whether pressing this element should play the standard Highrise button click sound effect (Default true)
haptic
Whether pressing this element should trigger a light haptic pulse (Default false)
Returns
A Callback object that can be passed to UnregisterCallback
Removes a specified child element from this element's hierarchy. Unity's VisualElement.Remove Documentation
Parameters
element
Returns
Remove a child at a specific index. Unity's VisualElement.RemoveAt Documentation
Parameters
index
Returns
Remove a class from the class list of the element. Unity's VisualElement.RemoveFromClassList Documentation
Parameters
className
Returns
Detaches this element from its parent, removing it from the visual tree. Unity's VisualElement.RemoveFromHierarchy Documentation
Returns
Add a style sheet to this visual element
Parameters
sheet
Returns
Parameters
Returns
Send the element to the back. Unity's VisualElement.SendToBack Documentation
Returns
Hide / Show an element. This is the equivalent of setting the display style to none or flex.
Parameters
display
Whether the element should be displayed
Returns
Set the enabled state of the element. Unity's VisualElement.SetEnabled Documentation
Parameters
value
Returns
Parameters
comp
Returns
Toggle a class in the class list of the element. Unity's VisualElement.ToggleInClassList Documentation
Parameters
className
Returns
Unregisters a callback using a Callback object.
Parameters
callback
The callback object that was returned by RegisterPressCallback, RegisterLongPressCallback or RegisterCallback.
Returns
Updated 17 days ago