SaladLab / Json.Net.Unity3D

Forked Newtonsoft.Json to support Unity3D
MIT License
918 stars 169 forks source link

Circular reference when serializing Vectors #39

Open SlimeQ opened 5 years ago

SlimeQ commented 5 years ago

When serializing a Unity vector such as Vector2 or Vector3, there is a circular reference on the normalized field.

This is not an issue in this other Json.Net implementation from the Unity store: https://assetstore.unity.com/packages/tools/input-management/json-net-for-unity-11347

I was hoping to be able to upgrade since that one has been unsupported for a long time and uses an old version of Json.Net, however this is a deal breaker. I'm not 100% sure what they did to make Vectors work, but the source code is available in that package. Probably the normalized field just needs to be explicitly omitted.