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");