Custom controls in UI Toolkit allow you to create reusable interface elements that combine structure, styling, and behavior into a single component.
This video walks you through building a custom SlideToggle control in UI Toolkit.
You’ll see how to expose it to UXML with UxmlElement and UxmlAttribute, style it with USS, and derive from BaseField to support labels, value changes, and data binding.
Learn more about custom controls: https://on.unity.com/CustomControls
Download the QuizU sample project: https://on.unity.com/QuizUSample
[0:00] Introduction
[0:25] Custom control demo
[0:55] Slide toggle setup
[2:55] BaseField class
[4:38] SlideToggle structure
[6:18] Adding click interaction
[6:57] Updating visuals and USS styling
[8:30] Applying the style sheet
[10:02] UI Builder and application
[11:40] Wrap-up
_______________
Stay connected with us:
Games Twitter/X: https://x.com/unitygames
Instagram: https://www.instagram.com/unitytechnologies/
Discord: https://discord.com/invite/unity
Discussions: https://discussions.unity.com/
LinkedIn: https://www.linkedin.com/company/unity/
Facebook: https://www.facebook.com/unity3d.in/
Bluesky: https://bsky.app/profile/unity.com
Company Twitter/X: https://x.com/unity
#Unity #UIToolkit #CustomControls