Module | Type | Can read | Can write | Custom converter |
---|---|---|---|---|
Addressables | UnityEngine.AddressableAssets.AssetReference | ✔⁽⁷⁾ | ✔⁽⁷⁾ | ✔ |
Addressables | UnityEngine.AddressableAssets.AssetReferenceT<T> | ✔⁽⁷⁾ | ✔⁽⁷⁾ | ✔ |
AI/NavMesh | UnityEngine.AI.NavMeshDataInstance | ❌⁽²⁾ | ❓⁽³⁾ | ❌⁽²⁾ |
AI/NavMesh | UnityEngine.AI.NavMeshHit | ✔ | ✔ | ✖⁽¹⁾ |
AI/NavMesh | UnityEngine.AI.NavMeshLinkData | ✔ | ✔ | ✖⁽¹⁾ |
AI/NavMesh | UnityEngine.AI.NavMeshLinkInstance | ❌⁽²⁾ | ❓⁽³⁾ | ❌⁽²⁾ |
AI/NavMesh | UnityEngine.AI.NavMeshQueryFilter | ✔ | ✔ | ✔ |
AI/NavMesh | UnityEngine.AI.NavMeshTriangulation | ✔ | ✔ | ✔ |
Animation | UnityEngine.Keyframe | ✔ | ✔ | ✖⁽¹⁾ |
Camera | UnityEngine.BoundingSphere | ✔ | ✔ | ✖⁽¹⁾ |
Camera | UnityEngine.CullingGroupEvent | ✔ | ✔ | ✔ |
GameCenter | UnityEngine.SocialPlatforms.Range | ✔ | ✔ | ✖⁽¹⁾ |
Geometry | UnityEngine.Bounds | ✔ | ✔ | ✔ |
Geometry | UnityEngine.BoundsInt | ✔ | ✔ | ✔ |
Geometry | UnityEngine.Plane | ✔ | ✔ | ✔ |
Geometry | UnityEngine.Ray | ✔ | ✔ | ✖⁽¹⁾ |
Geometry | UnityEngine.Ray2D | ✔ | ✔ | ✖⁽¹⁾ |
Geometry | UnityEngine.Rect | ✔ | ✔ | ✔ |
Geometry | UnityEngine.RectInt | ✔ | ✔ | ✔ |
Geometry | UnityEngine.RectOffset | ✔ | ✔ | ✔ |
Graphics | UnityEngine.Resolution | ✔ | ✔ | ✔ |
Hashing | UnityEngine.Hash128 | ✔ | ✔ | ✔ |
Math | UnityEngine.Color | ✔ | ✔ | ✔ |
Math | UnityEngine.Color32 | ✔ | ✔ | ✔ |
Math | UnityEngine.FrustumPlanes | ✔ | ✔ | ✖⁽¹⁾ |
Math | UnityEngine.Gradient | ✔ | ✔ | ✖⁽¹⁾ |
Math | UnityEngine.GradientAlphaKey | ✔ | ✔ | ✖⁽¹⁾ |
Math | UnityEngine.GradientColorKey | ✔ | ✔ | ✖⁽¹⁾ |
Math | UnityEngine.Matrix4x4 | ✔ | ✔ | ✔ |
Math | UnityEngine.Quaternion | ✔ | ✔ | ✔ |
Math | UnityEngine.Vector2 | ✔ | ✔ | ✔ |
Math | UnityEngine.Vector2Int | ✔ | ✔ | ✔ |
Math | UnityEngine.Vector3 | ✔ | ✔ | ✔ |
Math | UnityEngine.Vector3Int | ✔ | ✔ | ✔ |
Math | UnityEngine.Vector4 | ✔ | ✔ | ✔ |
Math | UnityEngine.Rendering.SphericalHarmonicsL2 | ✔ | ✔ | ✔ |
Mathematics | Unity.Mathematics.half | ✔⁽⁹⁾ | ✔⁽⁹⁾ | ✔ |
Mathematics | Unity.Mathematics.boolN ⁽⁸⁾ | ✔⁽⁹⁾ | ✔⁽⁹⁾ | ✔ |
Mathematics | Unity.Mathematics.doubleN ⁽⁸⁾ | ✔⁽⁹⁾ | ✔⁽⁹⁾ | ✔ |
Mathematics | Unity.Mathematics.floatN ⁽⁸⁾ | ✔⁽⁹⁾ | ✔⁽⁹⁾ | ✔ |
Mathematics | Unity.Mathematics.halfN ⁽⁸⁾ | ✔⁽⁹⁾ | ✔⁽⁹⁾ | ✔ |
Mathematics | Unity.Mathematics.intN ⁽⁸⁾ | ✔⁽⁹⁾ | ✔⁽⁹⁾ | ✔ |
Mathematics | Unity.Mathematics.uintN ⁽⁸⁾ | ✔⁽⁹⁾ | ✔⁽⁹⁾ | ✔ |
Mathematics | Unity.Mathematics.boolNxN ⁽⁸⁾ | ✔ | ✔ | ✖⁽¹⁾ |
Mathematics | Unity.Mathematics.doubleNxN ⁽⁸⁾ | ✔ | ✔ | ✖⁽¹⁾ |
Mathematics | Unity.Mathematics.floatNxN ⁽⁸⁾ | ✔ | ✔ | ✖⁽¹⁾ |
Mathematics | Unity.Mathematics.intNxN ⁽⁸⁾ | ✔ | ✔ | ✖⁽¹⁾ |
Mathematics | Unity.Mathematics.uintNxN ⁽⁸⁾ | ✔ | ✔ | ✖⁽¹⁾ |
NativeArray | Unity.Collections.NativeArray<T> | ❌⁽⁴⁾ | ✔ | ✔ |
NativeArray | Unity.Collections.NativeSlice<T> | ❌⁽⁴⁾ | ✔ | ✔ |
ParticleSystem | UnityEngine.ParticleSystemJobs.ParticleSystemJobData | ❌⁽⁴⁾ | ❔⁽⁵⁾ | ❌⁽⁴⁾ |
ParticleSystem | UnityEngine.ParticleSystemJobs.ParticleSystemNativeArray3 | ❌⁽⁴⁾ | ❔⁽⁵⁾ | ❌⁽⁴⁾ |
ParticleSystem | UnityEngine.ParticleSystemJobs.ParticleSystemNativeArray4 | ❌⁽⁴⁾ | ❔⁽⁵⁾ | ❌⁽⁴⁾ |
Physics | UnityEngine.BoxcastCommand | ✔ | ✔ | ✖⁽¹⁾ |
Physics | UnityEngine.CapsulecastCommand | ✔ | ✔ | ✖⁽¹⁾ |
Physics | UnityEngine.ContactPoint | ❌⁽²⁾ | ❓⁽³⁾ | ❌⁽²⁾ |
Physics | UnityEngine.JointDrive | ✔ | ✔ | ✔ |
Physics | UnityEngine.JointLimits | ✔ | ✔ | ✔ |
Physics | UnityEngine.JointMotor | ✔ | ✔ | ✖⁽¹⁾ |
Physics | UnityEngine.JointSpring | ✔ | ✔ | ✖⁽¹⁾ |
Physics | UnityEngine.PhysicsScene | ❌⁽²⁾ | ❓⁽³⁾ | ❌⁽²⁾ |
Physics | UnityEngine.RaycastCommand | ✔ | ✔ | ✖⁽¹⁾ |
Physics | UnityEngine.RaycastHit | ❌⁽²⁾ | ❓⁽³⁾ | ❌⁽²⁾ |
Physics | UnityEngine.SoftJointLimit | ✔ | ✔ | ✔ |
Physics | UnityEngine.SoftJointLimitSpring | ✔ | ✔ | ✖⁽¹⁾ |
Physics | UnityEngine.SpherecastCommand | ✔ | ✔ | ✖⁽¹⁾ |
Physics | UnityEngine.WheelFrictionCurve | ✔ | ✔ | ✖⁽¹⁾ |
Physics2D | UnityEngine.ColliderDistance2D | ✔ | ✔ | ✔ |
Physics2D | UnityEngine.ContactFilter2D | ✔ | ✔ | ✔ |
Physics2D | UnityEngine.ContactPoint2D | ❌⁽²⁾ | ❓⁽³⁾ | ❌⁽²⁾ |
Physics2D | UnityEngine.JointAngleLimits2D | ✔ | ✔ | ✖⁽¹⁾ |
Physics2D | UnityEngine.JointMotor2D | ✔ | ✔ | ✖⁽¹⁾ |
Physics2D | UnityEngine.JointSuspension2D | ✔ | ✔ | ✖⁽¹⁾ |
Physics2D | UnityEngine.JointTranslationLimits2D | ✔ | ✔ | ✖⁽¹⁾ |
Physics2D | UnityEngine.PhysicsJobOptions2D | ✔ | ✔ | ✖⁽¹⁾ |
Physics2D | UnityEngine.PhysicsScene2D | ❌⁽²⁾ | ❓⁽³⁾ | ❌⁽²⁾ |
Physics2D | UnityEngine.RaycastHit2D | ❌⁽²⁾ | ❓⁽³⁾ | ❌⁽²⁾ |
Random | UnityEngine.Random.State | ✔ | ✔ | ✔ |
Rendering | UnityEngine.Rendering.BatchCullingContext | ❌⁽⁴⁾ | ❔⁽⁵⁾ | ❌⁽⁴⁾ |
Rendering | UnityEngine.Rendering.BatchVisibility | ❌⁽⁶⁾ | ❔⁽⁵⁾ | ❌⁽⁶⁾ |
RenderPipeline | UnityEngine.Rendering.FilteringSettings | ✔ | ✔ | ✖⁽¹⁾ |
RenderPipeline | UnityEngine.Rendering.RenderQueueRange | ✔ | ✔ | ✖⁽¹⁾ |
RenderPipeline | UnityEngine.Rendering.SortingLayerRange | ✔ | ✔ | ✖⁽¹⁾ |
RenderPipeline | UnityEngine.Rendering.VisibleLight | ❌⁽²⁾ | ❓⁽³⁾ | ❌⁽²⁾ |
Scripting | UnityEngine.LayerMask | ✔ | ✔ | ✔ |
Scripting | UnityEngine.RangeInt | ✔ | ✔ | ✔ |
Scripting | UnityEngine.ScriptableObject | ✔ | ✔ | ✔ |
SpriteShape | UnityEngine.U2D.AngleRangeInfo | ✔ | ✔ | ✖⁽¹⁾ |
SpriteShape | UnityEngine.U2D.ShapeControlPoint | ✔ | ✔ | ✖⁽¹⁾ |
SpriteShape | UnityEngine.U2D.SpriteShapeMetaData | ✔ | ✔ | ✖⁽¹⁾ |
-
✖ Does not need a custom converter. Works out of the box as-is.
-
❌ Contains ID or reference to UnityEngine.Object and will therefore never be deserializable.
-
❓ Serializing this type is discouraged. Serializing this type will highly likely result in errors such as self referencing loops or infinite recursions.
-
❌ Type directly or indirectly contains reference to the NativeArray or NativeSlice types. Deserializing these types will cause imminent memory leaks and so deserializing (reading JSON) using these types are therefore highly discouraged.
-
❔ Serializing this type has not been tested nor proven to work. It is fully possible they work alright, but be wary.
-
❌ Type contains fields marked as
readonly
and therefore has been left out. Possible to solve by using reflection tricks but this has been down prioritized. -
✔ Support for Addressables package, which was added in v1.4.0, is only automatically included if your Unity project has imported the
com.unity.addressable
package. This automatic inclusion relies on AssemblyDefinition version defines, which was introduced in Unity 2019.1.x. To enable theAssetReferenceConverter
in earlier versions of Unity, please addHAVE_MODULE_ADDRESSABLES
to your project's "Scripting Define Symbols" found in the "Project Settings" -> "Player" -> "Other Settings" panel. -
✔ The
N
infloatN
,intN
, etc. stands for all the different vector types available in Unity.Mathematics:float2
,float3
,float4
, etc. Similarly, theNxN
infloatNxN
,intNxN
, etc. stands for all the different matrix types:float2x2
,float2x3
,float4x4
, etc. -
✔ Support for Mathematics package, which was added in v1.6.0, is only automatically included if your Unity project has imported the
com.unity.mathematics
package. This automatic inclusion relies on AssemblyDefinition version defines, which was introduced in Unity 2019.1.x. To enable for example theFloat3Converter
in earlier versions of Unity, please addHAVE_MODULE_MATHEMATICS
to your project's "Scripting Define Symbols" found in the "Project Settings" -> "Player" -> "Other Settings" panel.
-
Module: Most converters are created by referencing the GitHub repository for the Unity types made by Unity Technologies themselves. (https://github.com/Unity-Technologies/UnityCsReference) The "modules" concept is taken from there where all types are grouped by category instead of by namespace.
-
Type: The namespace (in italic) and type name (in bold), giving the full name for said type.
-
Can read: reading JSON is also known as "deserializing". Tómàtò-Tómátó. A green check mark ✔ here means that it has been proven via tests to deserialize when all significant data is specified in the JSON and successfully construct an instance of said type with no data loss.
-
Can write: writing JSON is also known as "serializing". Where it writes JSON based on the values of the instance. A green check-mark ✔ here means that it has been proven via tests to serialize this type with no data loss.
-
Custom converter: This package, jilleJr/Newtonsoft.Json-for-Unity.Converters, comes with a converter to resolve any serialization or deserialization bugs for said type, making it work as expected.
All types with green check-mark ✔ are proven to work via the suite of tests found in this repository. The tests prove the types work in many obscure scenarios in all of the following configurations:
OS | Unity | Json .NET for Unity version |
---|---|---|
Linux | 2020.1.0b6 | 13.0.102 |
- | - | 12.0.302 |
- | - | 11.0.202 |
- | - | 10.0.302 |
- | 2019.2.11f1 | 13.0.102 |
- | - | 12.0.302 |
- | - | 11.0.202 |
- | - | 10.0.302 |
- | 2018.4.14f1 | 13.0.102 |
- | - | 12.0.302 |
- | - | 11.0.202 |
- | - | 10.0.302 |