3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

自作パッケージで自作パッケージを使用したい【UnityPackageManager】

Posted at

package.jsonのdependenciesに自作パッケージは適用できない

まず前提条件として、自作パッケージをパッケージするにあたって必要となるpackage.jsonだが、このjson内のdependenciesではなぜか、自作パッケージのgitリポジトリURLで依存関係を適用することができない。(Unity起動時に依存解決する際にエラーが発生する)したがって、自作パッケージで自作パッケージを適用したい場合は、別の方法を取る必要がある。

適用方法

1. AssemblyDefineに適用するパッケージのguid参照を登録する

パッケージするにあたって、プロジェクトにAssemblyDefineファイルを配置する必要があるが、自作パッケージ通しで別のAssemblyDefineを使用するため、片方が依存関係を持つ場合、もう片方のguidの参照を登録する必要がある。

Screen Shot 2020-02-06 at 21.56.50.png

2. 自作パッケージを使用する先のPackage/manifest.jsonで依存関係のあるパッケージもdependenciesに登録する

例えば、unity-master-dataという自作パッケージでunity-excelという自作パッケージを使用していて、別のプロジェクトでunity-master-dataを使用したい場合、Package/manifest.jsonに両方を追加する必要がある。

{
  "dependencies": {
    "com.tani-shi.unity-excel": "https://github.com/tani-shi/unity-excel.git#1.0.0",
    "com.tani-shi.unity-master-data": "https://github.com/tani-shi/unity-master-data.git#1.0.0",
    ...
    }
}
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?