Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writer get confused with calculated properties #41

Open
jrmgx opened this issue Oct 27, 2020 · 0 comments
Open

Writer get confused with calculated properties #41

jrmgx opened this issue Oct 27, 2020 · 0 comments

Comments

@jrmgx
Copy link

jrmgx commented Oct 27, 2020

Given the current class

using System;
using UnityEngine;

[Serializable]
public class SzVector3
{
    public Vector3 Value => new Vector3(x, y, z); // Buggy

    public float x;
    public float y;
    public float z;

    public SzVector3(Vector3 v)
    {
        x = v.x;
        y = v.y;
        z = v.z;
    }
}

the writer will fail to build a json representation of this object with exception: TargetParameterCountException: Number of parameters specified does not match the expected number.

if you change the calculated propertie to a method like so public Vector3 Value() => new Vector3(x, y, z);
it works.

I'm not a specialist so I can not help much more than that report

Thank you for that lib and for your time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant