Skip to content

Writer get confused with calculated properties #41

@jrmgx

Description

@jrmgx

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions