Hi, I want to share with you one of my libraries:
UI Toolkit Plus
at GitHub
Description
Bunch of UI Toolkit generic features that can be resused across multiple projects.
Features
UXML C# Script generation
You can generate a partial C# class from the UXML file.
Given the following UXML file “MainMenuView.uxml”:
<ui:VisualElement>
<ui:Label name="title" />
</ui:VisualElement>
<ui:VisualElement name="menu">
<ui:Button name="confirm-button" />
</ui:VisualElement>
The tool will generate C# script “MainMenuView.gen.cs”:
- this script will be regenerated automatically each time corresponding uxml file changes.
- this is an opt-in feature by design, C# files will be generated only for for files that you chose.
- tool picks up relevant assembly and generates appropriate namespace for generated cs file.
- more documentation here
partial class MainMenuView
{
private Label title;
private VisualElement menu;
private Button confirmButton;
private void AssignQueryResults(VisualElement root)
{
title = root.Q<Label>("title");
menu = root.Q<VisualElement>("menu");
confirmButton = root.Q<Button>("confirm-button");
}
}
QAttribute
This is alternative way to retrieve references from Visutal Tree Asset,
Where standard VisualElement query looks like this:
public class ExampleEditorWindow
{
ObjectField objField;
ListView listView;
Label label;
void OnEnable()
{
objField = rootVisualElement.Q<ObjectField>("objField");
listView = rootVisualElement.Q<ListView>("listView");
label = rootVisualElement.Q<Label>("label");
}
}
With QAttribute it looks like this:
public class ExampleEditorWindow
{
[Q("objField")] ObjectField objField;
[Q("listView")] ListView listView;
[Q("label")] Label label;
void OnEnable()
{
rootVisualElement.AssignQueryResults(this);
}
}
QAttribute marks the class member as a query target, and the AssignQueryResults extension method assigns appropriate UQuery results to those members.
Copy Field Declarations (UI builder extension)
Select visual element in your UI Builder hierarchy and use UI Builder/Copy Field Declarations shortcut (Alt + C). This will copy C# field declarations for the selected visual element and its children.
Copied C# field declarations:
[Q("root")]
private VisualElement root;
[Q("child")]
private VisualElement child;
ReorderableManipulator

Manipulator class that allows you to drag and drop visual elements to reorder them.
TabGroup and Tab

TabGroup, Tab, and TabDropdown are new elements for any tab-related functionality.
Installation
Get GitHub repo URL and follow these instructions.
Feedback
Let me know if you found anything useful in here or if you wish something was more polished. ![]()


