-
Fixed converter lookups collisions when multiple assemblies converters with the same name, as it was not resolving assemblies in an exact way nor deterministic order:
-
Added assembly name field to
ConverterConfig
for each converter. -
Changed TypeCache to sort assemblies based on
FullName
and some heuristics. -
Changed TypeCache to lookup type in correct assembly, based on the assembly's name.
-
-
Fixed typo in the new Unity.Mathematics QuaternionConverter's namespace: from
Newtonsoft.Json.UnityConverters.Math.QuaternionConverter
toNewtonsoft.Json.UnityConverters.Mathematics.QuaternionConverter
(Math
→Mathematics
). (#87) -
Fixed compilation error when using Unity.Mathematics with Newtonsoft.JSON v10. (#87)
-
Fixed UnityConvertersConfigEditor scriptable object asset throwing error after recompiling scripts in Unity 2022.3.0 when selected and shown in inspector. (#82)
Thanks @EpsilonD3lta for the implementation (#83)
-
Added converters for Unity.Mathematics. This includes all the
float2
,double3
,int4
,bool4
, and similar types. (#80)There are no custom converters for the matrix types (
float2x2
,float2x3
, etc), as they currently work out-of-the-box. -
Added
ResolutionConverter
to be able to read JSON from older Unity versions. (#79) -
Fixed compilation errors when targeting .NET Standard 2.1. (#79)
-
Fixed converter types taking long time to load, sometimes causing lag spikes each time assembly got reloaded (especially when entering play-mode).
The issue was that this package tries to find all converters by looping through all types in all assemblies.
You should see better performance now, as we are using more optimized code paths and making use of Unity's TypeCache.
If your project still suffers from big lag spikes, then you can opt-out completely of the "auto type scanning" code via the settings found at "Edit > Json.NET converters settings..." (#79)
- Fixed converters being stripped when Managed Stripping Level is set to
anything higher than "minimal", by adding
[Preserve]
attribute to the entire assemblies. (#73)
-
Added support for
UnityEngine.AddressableAssets.AssetReferenceT<T>
, in addition to the existing support for the non-genericAssetReference
version introduced in v1.4.0.
-
Added support for
UnityEngine.AddressableAssets.AssetReference
. The newAssetReferenceConverter
is only included in the build if your project contains thecom.unity.addressables
package. (#67)This automatic inclusion relies on AssemblyDefinition version defines, which was introduced in Unity 2019.1.x. To enable the
AssetReferenceConverter
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.
-
Changed the following modules to be automatically excluded from compilation if they are not used in the project:
com.unity.modules.ai
via new defineHAVE_MODULE_AI
com.unity.modules.physics
via new defineHAVE_MODULE_PHYSICS
com.unity.modules.physics2d
via new defineHAVE_MODULE_PHYSICS2D
This is active starting with Unity 2019.1.x. The regarded modules are always active in prior Unity versions.
Thanks @SolidAlloy for the implementation (#60)
- Changed
UnityConverterInitializer
frominternal
topublic
. (#58)
- Fixed Newtonsoft.Json converters (ex:
StringEnumConverter
&VersionConverter
) not being loaded even if you had then enabled in the Newtonsoft.Json-for-Unity.Converters config. (#55)
-
Added configurability to enable/disable any converter that was all previously inserted automatically. Access the settings via the menu at "Edit > Json .NET converters settings..." (#40)
-
Added custom contract resolver to look for the
UnityEngine.SerializeFieldAttribute
and include attributed fields and properties appropriately. (#39) -
Added
UnityEngine.ScriptableObject
deserialization support by using theScriptableObject.Create(Type type)
method when reading the JSON. (#39) -
Fixed IL2CPP builds failing due to usage of
__makeref
inCullingGroupEventConverter
,ColliderDistance2DConverter
, andRandomStateConverter
(#35) -
Fixed
float
precision error when reading/prasing. (#46, #51) -
Added support for populating using
JsonConvert.PopulateObject
when using any of the custom converters. (#49) -
Removed the array passing and reflection in the PartialConverter and removed all partial converters except
PartialConverter.cs
, simplifying the code a lot. This should lead to a minor performance boost as well. (#48)
-
✨ Initial release
-
❤ Big love from these authors allowing me to take inspiration from their converters packages:
- ParentElement https://github.com/ianmacgillivray/Json-NET-for-Unity
- Wanzyee Studio http://wanzyeestudio.blogspot.com/2017/03/jsonnet-converters.html
-
UnityConverterInitializer that registers converters on load
-
Ensured via tests to work in Unity version:
- 2018.4
- 2019.2
- 2020.1
-
Ensured via tests to work with API compatibility:
- .NET Standard 2.0
-
Ensured via tests to work with Newtonsoft.Json version:
- 12.0.3
-
Added custom converters for following types:
- (AI/NavMesh) UnityEngine.AI.NavMeshQueryFilter
- (AI/NavMesh) UnityEngine.AI.NavMeshTriangulation
- (Camera) CullingGroupEvent
- (Geometry) UnityEngine.Bounds
- (Geometry) UnityEngine.BoundsInt
- (Geometry) UnityEngine.Plane
- (Geometry) UnityEngine.Rect
- (Geometry) UnityEngine.RectInt
- (Geometry) UnityEngine.RectOffset
- (Hashing) UnityEngine.Hash128
- (Math) UnityEngine.Color
- (Math) UnityEngine.Color32
- (Math) UnityEngine.Quaternion
- (Math) UnityEngine.Rendering.SphericalHarmonicsL2
- (Math) UnityEngine.Vector2
- (Math) UnityEngine.Vector2Int
- (Math) UnityEngine.Vector3
- (Math) UnityEngine.Vector3Int
- (Math) UnityEngine.Vector4
- (Physics) UnityEngine.JointDrive
- (Physics) UnityEngine.JointLimits
- (Physics) UnityEngine.SoftJointLimit
- (Physics2D) UnityEngine.ColliderDistance2D
- (Physics2D) UnityEngine.ContactFilter2D
- (Random) UnityEngine.Random.State
- (Scripting) UnityEngine.LayerMask
- (Scripting) UnityEngine.RangeInt
-
Known to work, but no custom converter needed:
- (AI/NavMesh) UnityEngine.AI.NavMeshHit
- (AI/NavMesh) UnityEngine.AI.NavMeshLinkData
- (Animation) UnityEngine.Keyframe
- (Camera) BoundingSphere
- (GameCenter) UnityEngine.SocialPlatforms.Range
- (Geometry) UnityEngine.Ray
- (Geometry) UnityEngine.Ray2D
- (Graphics) UnityEngine.Resolution
- (Math) UnityEngine.FrustumPlanes
- (Math) UnityEngine.Gradient
- (Math) UnityEngine.GradientAlphaKey
- (Math) UnityEngine.GradientColorKey
- (Physics) UnityEngine.BoxcastCommand
- (Physics) UnityEngine.CapsulecastCommand
- (Physics) UnityEngine.JointMotor
- (Physics) UnityEngine.JointSpring
- (Physics) UnityEngine.RaycastCommand
- (Physics) UnityEngine.SoftJointLimitSpring
- (Physics) UnityEngine.SpherecastCommand
- (Physics) UnityEngine.WheelFrictionCurve
- (Physics2D) UnityEngine.JointAngleLimits2D
- (Physics2D) UnityEngine.JointMotor2D
- (Physics2D) UnityEngine.JointSuspension2D
- (Physics2D) UnityEngine.JointTranslationLimits2D
- (Physics2D) UnityEngine.PhysicsJobOptions2D
- (RenderPipeline) UnityEngine.Rendering.FilteringSettings
- (RenderPipeline) UnityEngine.Rendering.RenderQueueRange
- (RenderPipeline) UnityEngine.Rendering.SortingLayerRange
- (SpriteShape) UnityEngine.U2D.AngleRangeInfo
- (SpriteShape) UnityEngine.U2D.ShapeControlPoint
- (SpriteShape) UnityEngine.U2D.SpriteShapeMetaData
-
❌ KNOWN NOT TO WORK (contains ID or reference to UnityEngine.Object):
- (AI/NavMesh) UnityEngine.AI.NavMeshDataInstance
- (AI/NavMesh) UnityEngine.AI.NavMeshLinkInstance
- (Physics) UnityEngine.ContactPoint
- (Physics) UnityEngine.PhysicsScene
- (Physics) UnityEngine.RaycastHit
- (Physics2D) UnityEngine.ContactPoint2D
- (Physics2D) UnityEngine.PhysicsScene2D
- (Physics2D) UnityEngine.RaycastHit2D
- (RenderPipeline) UnityEngine.Rendering.VisibleLight
-
❌ KNOWN NOT TO WORK (contains NativeArray/NativeSlice):
- (NativeArray) Unity.Collections.NativeArray<>
- (NativeArray) Unity.Collections.NativeSlice<>
- (ParticleSystem) UnityEngine.ParticleSystemJobs.ParticleSystemJobData
- (ParticleSystem) UnityEngine.ParticleSystemJobs.ParticleSystemNativeArray3
- (ParticleSystem) UnityEngine.ParticleSystemJobs.ParticleSystemNativeArray4
- (Rendering) UnityEngine.Rendering.BatchCullingContext
-
❌ KNOWN NOT TO WORK (contains readonly fields):
- (Rendering) UnityEngine.Rendering.BatchVisibility