In a UXML file, you can use the
<Template> and the
<Style> elements to reference other UXML or USS files. The two elements both accept either an
src attribute or a
src attribute accepts relative paths and offers error messages at import time if an error happens, such as files are missing.
src attribute expects the file path to be relative to either the project root or the folder that contains the UXML file.
Important: You must include the file extension.
For example, to reference a UXML files that is located at
Assets\Editor\UXML and a USS file that is located at
Assets\Editor\USS, use any of the following formats:
path attribute uses the Unity Resources mechanisms, but doesn’t offer error reporting at import time and doesn’t allow relative paths.
path attribute accepts files located in either the
Resources folder or the
Editor Default Resources folder, with the following rules:
Resources folder, don’t include the file extension. For example, write
path="template" for a file located at
Editor Default Resources folder, you must include the file extension. For example, write
path="template.uxml" for a file located at
Assets/Editor Default Resources/template.uxml.