UXML 파일에서 <Template>
및 <Style>
요소를 사용하여 다른 UXML 또는 USS 파일을 참조할 수 있습니다.두 요소는 모두 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 리소스 메커니즘을 사용하지만 임포트 시 오류 보고 기능을 제공하지 않으며 상대 경로를 허용하지 않습니다.
path
속성은 다음 규칙에 따라 Resources
폴더 또는 Editor Default Resources
폴더에 있는 파일을 허용합니다.
Resources
폴더에 있는 경우 파일 확장자를 포함하지 마십시오.예를 들어, Assets/Resources/template.uxml
에 있는 파일에 대해 path="template"
을 작성합니다.Editor Default Resources
폴더에 있는 경우 파일 확장자를 포함해야 합니다.예를 들어, Assets/Editor Default Resources/template.uxml
에 있는 파일에 대해 path="template.uxml"
을 작성합니다.