public class Editor.Label : Editor.Widget
A simple text label.
Related Guides
Broader workflow and conceptual references connected to this API.
When creating your own Classes/Structs/Assets/ect, you'll sometimes want custom editors that pair with them. For example, a Gradient Editor so you can visually see what the Gradient looks like instead of editing the Gradient as if it were a Struct with a list of Colours.
Editor UI is built entirely out of Widgets. Widgets are different from Panels, which are used for in-game UI. Widgets can be various elements or components, such as labels, buttons, text boxes, trees, or images.
When displaying text such as Hello World, you should instead use a localization token like #menu.helloworld. This will automatically replace the text with the corresponding language set by the user when set on a Label, allowing you to easily support multiple languages.
Razor Component allow you to define some content to show inside another razor file. This makes it easy to create Panels that are more agile and reusable.
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:
Constructors
Showing 2 constructors
No results match this filter.
Properties
Showing 8 properties
public Sandbox.TextFlag Editor.Label.Alignment { get; set; }
public float Editor.Label.Indent { get; set; }
public float Editor.Label.Margin { get; set; }
public bool Editor.Label.OpenExternalLinks { get; set; }
If true, clicking a html link on this label will open the website. This is true by default.
public string Editor.Label.Text { get; set; }
The text of this label.
public bool Editor.Label.TextSelectable { get; set; }
public bool Editor.Label.WordWrap { get; set; }
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Editor |
| Type | class |
| Assembly | Sandbox.Tools |
| Doc ID | T:Editor.Label |