I have a unity project where i need to be able to deserialize really fast. I tried MessagePack. I followed the tutorial but when the deserialization is triggered i receive this error:
FormatterNotRegisteredException: DeserializedObject is not registered in resolver
This is my class:
using UnityEngine;
using MessagePack;
[MessagePackObject]
public class DeserializedObject
{
[Key(0)]
public SortedDictionary<string, SortedDictionary<string, ushort[,]>> features;
}
i call this from other class like this:
z-represents the bytes.
DeserializedObject ds = MessagePackSerializer.Deserialize<DeserializedObject>(z);
So i wonder how can i register my class ?
What i did was to generate resolver and formatter using this:
1. mpc.exe -i "..\src\Sandbox.Shared.csproj" -o "MessagePackGenerated.cs" -m
2. restart unity + vscode
3.
var resolver = MessagePack.Resolvers.CompositeResolver.Create(
NameOfGeneratedNamespace.Resolvers.NameOfResolver.Instance);
var options = MessagePackSerializerOptions.Standard.WithResolver(resolver);
DeserializedObject ds = MessagePackSerializer.Deserialize<DeserializedObject>(z,options);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With