This section explains how to access or refer to assets that are defined inside a package:
To refer to assets that are defined inside a package, use this path scheme:
"Packages/<package-name>/..."
The path of the asset inside a package begins with Packages/
and the package name (not the display name).
By contrast, you access project assets using this scheme:
"Assets/..."
예를 들어 com.unity.images-library 패키지에 있는 /Example/Images
패키지 하위 폴더의 image.png 파일에 대한 경로는 다음과 같습니다.
"Packages/com.unity.images-library/Example/Images/image.png"
패키지 내에 저장된 텍스처를 로드하려면 LoadAssetAtPath 메서드를 사용하고, 이 예제에 설명된 것처럼 Packages/<package-name>/
경로 체계에 따라 경로를 지정하십시오.
Texture2D texture = (Texture2D)AssetDatabase.LoadAssetAtPath("Packages/com.unity.images-library/Example/Images/image.png", typeof(Texture2D));
To get the absolute path of a packaged asset, use the Path.GetFullPath() method. For example:
string absolute = Path.GetFullPath("Packages/com.unity.images-library/Example/Images/image.png");