UXML ファイルでは、<Template> 要素と <Style> 要素を使って他の UXML ファイルや USS ファイルを参照することができます。この 2 つの要素は両方とも、src 属性か path 属性のいずれかを受け付けます。
src 属性Use the following syntax for the src attribute:
src="<path-to-file>/<file-name-with-extension>"
Any errors during import, such as missing files, trigger an error message.
You can use a relative or an absolute path:
Assets folder and begin with a / or project://database/. For example, /Assets/myFolder/myFile.uss or project://database/Assets/myFolder/myFile.uss./. For example, ../myFolder/myFile.uss.Note: To reference a file from packages, use the absolute path of the package file that starts from the Packages folder. For example, /Packages/com.unity.package.name/file-name.uss or project://database/Packages/com.unity.package.name/file-name.uss. you must use the format of com.unity.package.name rather than package name for the package name.
path 属性path 属性は Unity Resources メカニズムを使用しますが、インポート時のエラーレポートを提供せず、相対パスを許可しません。
path 属性は、以下の規則に基づき、Resources フォルダー内または Editor Default Resources フォルダー内にあるファイルを受け付けます。
Resources フォルダーにある場合は、ファイル拡張子を含めないでください。例えば、Assets/Resources/template.uxml にあるファイルの場合は path="template" と記述してください。Editor Default Resources フォルダーにある場合は、ファイル拡張子を含める必要があります。例えば、Assets/Editor Default Resources/template.uxml にあるファイルの場合は `path=“template.uxml” と記述してください。