環境
- Unity 2019.3.6f1
- MessaePack for C# v2.1.90
- Entities v0.8.0
エラーの内容
MessagePack for C# とEntitiesをInstallすると次のようにエラーが出ます。
PrecompiledAssemblyException: Multiple precompiled assemblies with the same name System. Runtime.CompilerServices.Unsafe.dll included for the current platform. Only one assembly with the same name is allowed per platform. Assembly paths: Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll
Assets/Scripts/MessagePack/SequenceReaderExtensions.cs(39,21): error CS0433: The type 'Unsafe' exists in both 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Assets/Scripts/MessagePack/Formatters/GenericEnumFormatter`1.cs(39,107): error CS0433: The type 'Unsafe' exists in both 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
これらのエラーはSystem.Runtime.CompilerServices.Unsafeが重複して存在することに起因しているようです。
解決法
Library/PackageCache/com.unity.collections@0.7.0-preview.2/ 以下にある
- System.Runtime.CompilerServices.Unsafe.dll
- System.Runtime.CompilerServices.Unsafe.dll.meta
を削除します。