文档

Unity Engine


User Manual

Script Reference

Unity Engine


Structure UI with UXML

Write UXML files, add styles to UXML, and reuse UXML templates.
阅读时间1 分钟最后更新于 24 天前

Unity Extensible Markup Language (UXML) files are text files that define the structure of the UI. UXML along with USS makes it easier for less technical users to define the layout and the style of the UI. This leaves developers with technical tasks, such as importing assets, defining logic, and processing data.

Topic

Description

Introduction to UXMLUnderstand the format of the UXML.
Add styles to UXMLLearn how to reference a USS file in UXML.
Reuse UXML filesLearn how to import a UXML file and override the attributes.
Reference other files from UXMLUnderstand the
src
and the
path
attributes used to reference other files from UXML.
Load UXML and USS from C# scriptsLoad UXML and USS as you would load a regular Unity asset.
Instantiate UXML with C#Learn how to instantiate UXML with C# by an example.
Find visual elements with UQueryUse UQuery to retrieve elements and learn UQuery best practices.