UIToolkit Extensions
Extension methods for Unity UIElements that enable fluent, LINQ-style UI creation. Simplifies building complex UI hierarchies with chainable methods for styling, layout, and element creation while maintaining clean, readable code.
com.ltmx.unity.uitoolkit.extensions 
Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/ltmx-extensions.git README Markdown
Copy this to your project's README.md
## Installation
Add **UIToolkit Extensions** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/ltmx-extensions.git
```
[](https://www.pkglnk.dev/pkg/ltmx-extensions)Dependencies (3)
README
Unity.UIToolkit.Extensions
Extension Library for Unity UIElements
Create UI using LINQ Syntax
Looks :
public static TextField CreateInputTextField(this VisualElement container)
{
var row = container.Row();
row.Image().USS("logo");
var inputTextField = row.TextField()
.Multiline(true)
.Value("Hello")
.ToolTip("[Shift + Enter] to SEND\n[Esc] to STOP chat")
.Placeholder("Type your message here")
.HidePlaceholderOnFocus(true);
return inputTextField;
}
Install
Unity > Package Manager > Install via Git URL > paste https://github.com/ltmx/Unity.UIToolkit.Extensions.git
Dependencies (automaticaly installed)
- com.unity.mathematics
- com.unity.modules.uielements (built in package)
Examples
Create Child Elements
element.Button();
element.TextField();
element.Label();
Styling
element.USS("my-style");
element.RemoveUSS("my-class");
element.ClearUSS("my-class");
element.WhereClassListContains("my-class");
element.FirstElementWithClass("my-class");
// of course everything links together
myButton.WhereClassListContains("unity-text-element").ClearUSS();
An example of how I create a Path Field
public PathField(string name) : base(name)
{
var button = new ActionButton(OpenPathInExplorer)
.USS("open-button")
.FlexShrink(1)
.FlexGrow(1)
.AlignSelf(Align.Center)
.Margin(0)
.MarginRight(8)
.Size(24)
.BackgroundSize(BackgroundSizeType.Contain);
Insert(1, button);
}
No comments yet. Be the first!