diff --git a/CHANGELOG.md b/CHANGELOG.md index d892a08..6533c43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +### [1.12.1](https://github.com/Thundernerd/Unity3D-SerializableInterface/compare/v1.12.0...v1.12.1) (2022-09-10) + + +### Bug Fixes + +* fix editor drawing of managed classes inside list ([8d66349](https://github.com/Thundernerd/Unity3D-SerializableInterface/commit/8d663496eef8eab34e5553617ad9697d3e61d8f1)) +* fix issue with unity version 2021.1 ([d81e9df](https://github.com/Thundernerd/Unity3D-SerializableInterface/commit/d81e9df6fbc4fb0eb2ca70c7b3a46418045923aa)), closes [Thundernerd/Unity3D-SerializableInterface#51](https://github.com/Thundernerd/Unity3D-SerializableInterface/issues/51) +* fix version directive in IconUtility ([ffe848c](https://github.com/Thundernerd/Unity3D-SerializableInterface/commit/ffe848c940898c22816268d8be2aa3d84721a678)), closes [Thundernerd/Unity3D-SerializableInterface#51](https://github.com/Thundernerd/Unity3D-SerializableInterface/issues/51) +* make changes requested in code review. Also, fix stop condition in for loop that traverses serialized property's path in SerializedPropertyUtilities.GetValue() function ([191d442](https://github.com/Thundernerd/Unity3D-SerializableInterface/commit/191d442026fbc37fb86cc980bce68bfb5e8fb874)) + ## [1.12.0](https://github.com/Thundernerd/Unity3D-SerializableInterface/compare/v1.11.1...v1.12.0) (2022-09-09) diff --git a/Editor/Drawers/ReferenceDrawer.cs b/Editor/Drawers/ReferenceDrawer.cs index 85e4010..c708c9e 100644 --- a/Editor/Drawers/ReferenceDrawer.cs +++ b/Editor/Drawers/ReferenceDrawer.cs @@ -219,12 +219,11 @@ protected void SetModeValue(SerializedProperty property, ReferenceMode mode) protected object GetRawReferenceValue(SerializedProperty property) { -#if UNITY_2021_1_OR_NEWER +#if UNITY_2021_2_OR_NEWER return property.RawReferenceProperty().managedReferenceValue; #else - ISerializableInterface instance = - (ISerializableInterface)FieldInfo.GetValue(property.serializedObject.targetObject); - return instance.GetRawReference(); + ISerializableInterface target = (ISerializableInterface) SerializedPropertyUtilities.GetValue(property); + return target.GetRawReference(); #endif } diff --git a/Editor/Utilities/IconUtility.cs b/Editor/Utilities/IconUtility.cs index 0f539aa..b95cd3e 100644 --- a/Editor/Utilities/IconUtility.cs +++ b/Editor/Utilities/IconUtility.cs @@ -5,7 +5,7 @@ namespace TNRD.Utilities { internal static class IconUtility { -#if UNITY_2021_1_OR_NEWER +#if UNITY_2021_2_OR_NEWER private static Texture2D folderIcon; public static Texture2D FolderIcon diff --git a/Editor/Utilities/SerializedPropertyUtilities.cs b/Editor/Utilities/SerializedPropertyUtilities.cs index aac3127..cabfef5 100644 --- a/Editor/Utilities/SerializedPropertyUtilities.cs +++ b/Editor/Utilities/SerializedPropertyUtilities.cs @@ -41,7 +41,7 @@ public static object GetValue(SerializedProperty property) object targetObject = property.serializedObject.targetObject; string[] elements = path.Split('.'); - for (int i = 0; i < elements.Length - 1; i++) + for (int i = 0; i < elements.Length; i++) { string element = elements[i]; if (element.Contains("[")) diff --git a/package.json b/package.json index f040261..55ec8f7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "net.tnrd.serializableinterface", - "version": "1.12.0", + "version": "1.12.1", "displayName": "Serializable Interface", "unity": "2020.1", "description": "A wrapper that allows serialization of interfaces that supports both UnityEngine.Object and regular object types",