Open
Description
My code is very simple
public class MyTest : MonoBehaviour
{
void Start()
{
var _d = new TestData() { data = Encoding.UTF8.GetBytes(\"Hello World\") };
MemoryPackSerializer.Serialize(_d);
}
}
[MemoryPackable]
public partial class TestData
{
public byte[] data;
}
But running in Unity will result in the following error message
MemoryPackSerializationException: TestData is not registered in this provider.
MemoryPack.MemoryPackSerializationException.ThrowNotRegisteredInProvider (System.Type type) (at <a3c91ce317d34ad180564c2b7f9a0687>:0)
MemoryPack.ErrorMemoryPackFormatter`1[T].Throw () (at <a3c91ce317d34ad180564c2b7f9a0687>:0)
MemoryPack.ErrorMemoryPackFormatter`1[T].Serialize[TBufferWriter] (MemoryPack.MemoryPackWriter`1[TBufferWriter]& writer, T& value) (at <a3c91ce317d34ad180564c2b7f9a0687>:0)
MemoryPack.MemoryPackWriter`1[TBufferWriter].WriteValue[T] (T& value) (at <a3c91ce317d34ad180564c2b7f9a0687>:0)
MemoryPack.MemoryPackSerializer.Serialize[T,TBufferWriter] (MemoryPack.MemoryPackWriter`1[TBufferWriter]& writer, T& value) (at <a3c91ce317d34ad180564c2b7f9a0687>:0)
MemoryPack.MemoryPackSerializer.Serialize[T] (T& value, MemoryPack.MemoryPackSerializerOptions options) (at <a3c91ce317d34ad180564c2b7f9a0687>:0)
MyTest.Start () (at Assets/Scripts/MyTest.cs:11)
In the test, I tested three types: byte[]
, int[]
, and List<byte>
, all of which resulted in the above error message. I want to know if it's due to incorrect usage or some other reason. Additionally, this issue occurs in both of my projects.
Metadata
Metadata
Assignees
Labels
No labels