public sealed struct Sandbox.UI.Length
A variable unit based length. ie, could be a percentage or a pixel length. This is commonly used to express the size of things in UI space, usually coming from style sheets.
Related Guides
Broader workflow and conceptual references connected to this API.
If you want a specific file/asset type to have a custom Thumbnail/Inspector Preview, you can simply create an AssetPreview. An AssetPreview initializes a SceneWorld and SceneCamera, rendering the Camera to the Preview output, so all you need to do is populate it and/or position the Camera to your liking.
In some circumstances you may want to add additional data to the network snapshot that gets sent to clients when they join a server. One example of this might be serializing and deserializing voxel world data.
A Vector is just a set of numbers that describe a position or a direction in space.
You can create links by adding a NavMeshLink Component to an GameObject.
UI can also be created using Razor, which allows you to use web-like HTML/CSS to create and style each Panel while also being able to leverage C#.
It is common to have a file system like this:
Methods
Showing 13 methods
public static System.Nullable`1<Sandbox.UI.Length> Calc(string expression)
Create a length based on a css calc expression
public static Sandbox.UI.Length Em(float value)
Create a length based on the font size of the current element.
Parameters
value: Value in em
Returns
A new length
public static System.Nullable`1<Sandbox.UI.Length> Fraction(float fraction)
Create a length in percents
Parameters
fraction: The fraction of a percent (0 = 0%, 1 = 100%)
Returns
A new length
public static System.Nullable`1<Sandbox.UI.Length> Parse(string value)
Parse a length. This is used by the stylesheet parsing system.
Parameters
value: A length represented by a string
Example
Built-in examples define the default contract and should be read first.
public static System.Nullable`1<Sandbox.UI.Length> Percent(float percent)
Create a length in percents
Parameters
percent: The amount of percent for this (0-100)
Returns
A new length
public static System.Nullable`1<Sandbox.UI.Length> Pixels(float pixels)
Create a length in pixels
Parameters
pixels: The amount of pixels for this length
Returns
A new length
public static Sandbox.UI.Length Rem(float value)
Create a length based on the font size of the root element.
Parameters
value: Value in rem
Returns
A new length
public static System.Nullable`1<Sandbox.UI.Length> ViewHeight(float percentage)
Create a length based on the view height
Parameters
percentage: The amount of percent for this (0-100)
Returns
A new length
public static System.Nullable`1<Sandbox.UI.Length> ViewMax(float percentage)
Create a length based on the longest edge of the screen size
Parameters
percentage: The amount of percent for this (0-100)
Returns
A new length
No results match this filter.
Properties
Showing 4 properties
public static Sandbox.UI.Length Sandbox.UI.Length.Auto { get; set; }
Quickly create a Length with Unit set to LengthUnit.Auto
public static Sandbox.UI.Length Sandbox.UI.Length.Contain { get; set; }
Quickly create a Length with Unit set to LengthUnit.Contain
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox.UI |
| Type | class |
| Assembly | Sandbox.System |
| Doc ID | T:Sandbox.UI.Length |