From f781ad737384f5a68f54fcb7a1c373fb02da7470 Mon Sep 17 00:00:00 2001 From: Makihiro Date: Fri, 16 Feb 2024 21:58:38 +0900 Subject: [PATCH] Fixed a bug when trying to deserialize a null type with FromJson. --- .../Editor/ManagedReferenceUtility.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Editor/ManagedReferenceUtility.cs b/Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Editor/ManagedReferenceUtility.cs index 6f96e4c..577efde 100644 --- a/Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Editor/ManagedReferenceUtility.cs +++ b/Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Editor/ManagedReferenceUtility.cs @@ -12,7 +12,7 @@ public static object SetManagedReference (this SerializedProperty property,Type #if UNITY_2021_3_OR_NEWER // NOTE: managedReferenceValue getter is available only in Unity 2021.3 or later. - if (property.managedReferenceValue != null) + if (property.managedReferenceValue != null && type != null) { // Restore an previous values from json. string json = JsonUtility.ToJson(property.managedReferenceValue);