JasonXuDeveloper / Nino

Definite useful and high performance serialization library for any C# projects, including but not limited to .NET Core apps or Unity/Godot games.
https://nino.xgamedev.net
MIT License
468 stars 44 forks source link

反序列化错误 #108

Closed liujunfan closed 3 months ago

liujunfan commented 11 months ago

![Uploading [24KY~A47V_O6}X1()W`(]M.png…]()

liujunfan commented 11 months ago

U(67% )P8CU@CTID5M8U5HG

JasonXuDeveloper commented 11 months ago

啥信息都没提供光截个这图我咋知道你遇到啥问题。

liujunfan commented 11 months ago

24KY~A47V_O6}X1()W`( M

JasonXuDeveloper commented 11 months ago

Vector2Int 也截图啊

JasonXuDeveloper commented 11 months ago

别用改造过的代码,用原代码先试试

liujunfan commented 11 months ago

Vector2也报错。试过了 Vector2Int 是unity自带的

liujunfan commented 11 months ago

7GT}UR5OZLO({B03%BBJLDX int 没问题, unity 结构报错

JasonXuDeveloper commented 11 months ago

别发截图了,请直接把代码粘过来

JasonXuDeveloper commented 11 months ago

写个能复现的案例

liujunfan commented 11 months ago
using Vector3 = System.Numerics.Vector3;

[NinoSerialize]
public partial class TestB
{
    public Dictionary<int, TestC> TestCs;
}

[NinoSerialize]
public partial class TestC
{
    public Vector3 v2;
    public Vector3[] v2s;
}
public class Test : MonoBehaviour
{
    public void Awake()
    {
        TestB testB = new TestB();
        testB.TestCs = new();
        TestC c1 = new TestC();
        c1.v2 = new Vector3( 10,0, 10);
        c1.v2s = new []
        {
            new Vector3( 10,0, 10),
            new Vector3( 11,0, 11)
        };

        testB.TestCs.Add(0, c1);

        var bytes =  Serializer.Serialize(testB);

        TestB b = Deserializer.Deserialize<TestB>(bytes);
    }
}
liujunfan commented 11 months ago
using Vector3 = System.Numerics.Vector3;
[NinoSerialize]
public partial class TestC
{
    public Vector3[] v2s;
}
public class Test : MonoBehaviour
{
    public void Awake()
    {
        TestC c1 = new TestC();
        c1.v2s = new []
        {
            new Vector3( 10,0, 10),
            new Vector3( 11,0, 11)
        };

        var bytes =  Serializer.Serialize(c1);

        TestC b = Deserializer.Deserialize<TestC>(bytes);
        int n = 0;
    }
}
JasonXuDeveloper commented 3 months ago

已在v2.0.0修复