🥲
UnityでNugetForUnityでSourceGeneratorを使うライブラリに何もしてないのにエラーが出る問題
発生したエラー
Assembly 'Assets/Packages/CommandForgeGenerator.1.0.8/analyzers/dotnet/cs/CommandForgeGenerator.dll' will not be loaded due to errors:
Unable to resolve reference 'Microsoft.CodeAnalysis'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
Unable to resolve reference 'System.Collections.Immutable'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
環境
Unity 6000.1.1f
NugetForUnity 4.1.0
再現方法
すでに入れているSourceGeneratorを使うライブラリ(UnitGenerator等)のバージョンをUpdateする、再インストールする。
エラーの修正方法
- 入れたライブラリのDLLをクリック
- InspectorからAny Platform,Editor、Standaloneのチェックを外す
- RoslynAnalyzerのタグを付加する
恒久的な不具合対策
上記の手法は一時的な修正で、再度NugetForUnityからアップデートを実行すると再発します。
NugetForUnityを4.4.0にアップデートすると、ライブラリをアップデートしてもエラーが発生しなくなります。
Discussion
補足情報
4.1.1で修正されたissueです。