From c12fe06b2d6beb9d3401b165d733f8b2c26600ad Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Sun, 15 Sep 2024 00:00:32 +0800 Subject: [PATCH] fix ResetValues for SerializedProperty --- src/Internal/Editor/UnityEditorUtility.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Internal/Editor/UnityEditorUtility.cs b/src/Internal/Editor/UnityEditorUtility.cs index 0a5c91f..037c846 100644 --- a/src/Internal/Editor/UnityEditorUtility.cs +++ b/src/Internal/Editor/UnityEditorUtility.cs @@ -117,6 +117,10 @@ namespace DCFApixels.DragonECS.Unity.Editors private static Dictionary scriptsAssets = new Dictionary(256); internal static void ResetValues(this SerializedProperty property, bool isExpand = false) + { + ResetValues_Internal(property.Copy(), isExpand, property.depth); + } + private static void ResetValues_Internal(SerializedProperty property, bool isExpand, int depth) { property.isExpanded = isExpand; switch (property.propertyType) @@ -127,9 +131,11 @@ namespace DCFApixels.DragonECS.Unity.Editors //InvalidOperationException: The operation is not possible when moved past all properties (Next returned false) //и не дает инструментов и шансов этого избежать { - while (property.Next(true)) + bool x = true; + while (property.Next(x) && property.depth > depth) { - property.ResetValues(isExpand); + ResetValues_Internal(property, isExpand, property.depth); + x = false; } } catch (Exception) { }