20. Unity向け
• MessagePack.UnityShims package
provides shim of Unity's standard struct
Vector2/Vector3/Vector4/Quaternion,
Color, Bounds, Rect,
AnimationCurve, Keyframe,
Matrix4x4, Gradient, Color32, RectOffset,
LayerMask, Vector2Int, Vector3Int,
RangeInt, RectInt, BoundsInt) and there
formatter.
It can enable to communicate between
server and Unity client.
29. エラー出た2
Assets/Scripts/MessagePack/Internal/ThreadsafeTypeKeyHashTable.cs(187,30): error CS0234: The type or namespace name `Volatile' does not exist in the namespace
`System.Threading'. Are you missing an assembly reference?
Assets/Scripts/MessagePack/Resolvers/CompositeResolver.cs(84,66): error CS1061: Type `System.Type' does not contain a definition for `GetTypeInfo' and no extension
method `GetTypeInfo' of type `System.Type' could be found. Are you missing `HoloToolkit' using directive?
29
解決法
Scripting Backend
を.
NET 4.xに変更
30. エラー出た3
解決法
StandalonePCで無い(UWP/Android/iOS等)
時は、Resolverを別途準備しないといけない
mpc.exeというツールを使うと、
MessagePackGenerated.csというファイルを
生成しくれるので、それを使う
FormatterNotRegisteredException: MyClass is not registered in this resolver.
resolver:StandardResolverMessagePack.FormatterResolverExtensions.GetFormatterWithVe
rify[T] (MessagePack.IFormatterResolver resolver) (at
Assets/Scripts/MessagePack/IFormatterResolver.cs:35)
mpc.exe –i {Unityプロジェクトの}.csproj -o {書き出し先}/MessagePackGenerated.cs"
30
If you want to avoid generate cost or run
on Xamarin or Unity, you need pre-code
generation. mpc.exe(MessagePackComp
iler) is code generator of MessagePack
for C#. mpc can download
from releases page, mpc.zip. mpc is
using Roslyn so analyze source code.
https://github.com/neuecc/MessagePa
ck-CSharp#pre-code-
generationunityxamarin-supports
31. エラー出る4
Assets/Scripts/MessagePackGererated/MessagePackGenerated.cs(799,25): error CS0101: The
namespace `MessagePack.Formatters.HoloToolkit.Unity.InputModule' already contains a definition
for `RecognizerStartBehaviorFormatter'
31
解決法
mpc.exeは、Resolverコードを生成する際に、対象プロジェクトの全てのソースコードを
解析するっぽい。
既存ライブラリにserializer/Formatterなどの名前があると、エラーになったりする。
除外する方法知っている方教えてください。
困難な場合は、別プロジェクトでResolverのみ生成した方が良いかも。