Extension Library for Unity UIElements
Looks :
public static TextField CreateInputTextField(this VisualElement container)
{
var row = container.Row();
row.Image().USS("logo");
var inputTextField = row.TextField()
.Multiline(true)
.Value(AthenaSettings.DefaultPrompt)
.ToolTip("[Shift + Enter] to SEND\n[Esc] to STOP chat")
.Placeholder("Type your message here")
.HidePlaceholderOnFocus(true);
return inputTextField;
}
Unity > Package Manager > Install via Git URL > paste https://github.com/ltmx/Unity.UIToolkit.Extensions.git
- com.unity.mathematics
- com.unity.modules.uielements (built in package)
element.Button();
element.TextField();
element.Label();
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();
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);
}