Element
Derived: Simple, Label, Button, TextBox, Scrollbar
UI.Element is the base class for all UI elements / controls. It manages UnityEngine.GameObject and its RectTransform, provides layout settings and basic AddElement to add child elements. All elements must ultimately be hosted inside UI.Window.
Instance Properties:
GameObject: GameObject - [Unsafe] Unity API Game object of the content.RootObject: GameObject - [Unsafe] Unity API Root game object that will be added as a child when adding this element to another element. Same asGameObjectfor simple elements.RectTransform: RectTransform - [Unsafe] Unity APIRectTransform ofRootObject(which is the same asGameObjectfor simple elements.Parent: Element - Parent element (inside which this element is).Tag: Object - Tag for general usage.Name: string - Optional name of the element/control. Returns type name if not assigned (null).Active: bool - Element is set to be visible/active.RootObject.activeSelf,RootObject.SetActiveVisible: bool - Element is visible (and all parents are).RootObject.activeInHierarchy,RootObject.SetActiveWidth: float - Current width, redirects to PreferWidth when assigning.Height: float - Current height, redirects to PreferHeight when assigning.MinWidth: float - Minimal width if set to non-negative number (readsfloat.NaNotherwise, which means that the minimal width is not set - assigning negative number will have same result).MinHeight: float - Minimal height (same negative/float.NaNlogic as above and for many below).PreferWidth: float - Preferred width if set (the layout will use this if possible).PreferHeight: float - Preferred height if set (the layout will use this if possible).FlexWidth: float - Flexible width if inside horizontal/vertical layout.FlexHeight: float - Flexible height if inside horizontal/vertical layout.
Static Methods:
LoadIcon(): Texture2D, width int, height int, path string- [
Unsafe] Load icon of specified dimensions asTexture2Dfrom a file (fromResourcesdirectory orResources.zip).
- [