From 0d52c937dd7c9372acf71c2853b7fdedd3742047 Mon Sep 17 00:00:00 2001 From: Vladislav Panin Date: Sun, 21 Jun 2026 23:25:54 +0300 Subject: [PATCH] fix(serialize-reference): persist property in deferred menu callbacks --- .../Drawers/SerializeReferenceIMGUIPropertyDrawer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Aspid.FastTools/Packages/tech.aspid.fasttools/Unity/Editor/Scripts/SerializeReferences/Drawers/SerializeReferenceIMGUIPropertyDrawer.cs b/Aspid.FastTools/Packages/tech.aspid.fasttools/Unity/Editor/Scripts/SerializeReferences/Drawers/SerializeReferenceIMGUIPropertyDrawer.cs index ba0ce906..65a328ac 100644 --- a/Aspid.FastTools/Packages/tech.aspid.fasttools/Unity/Editor/Scripts/SerializeReferences/Drawers/SerializeReferenceIMGUIPropertyDrawer.cs +++ b/Aspid.FastTools/Packages/tech.aspid.fasttools/Unity/Editor/Scripts/SerializeReferences/Drawers/SerializeReferenceIMGUIPropertyDrawer.cs @@ -334,7 +334,7 @@ private static void ShowContextMenu(SerializedProperty property, Type fieldType) { var path = candidate.Path; menu.AddItem(new GUIContent($"Link to Existing/{candidate.Type.Name} ({path})"), false, - () => SerializeReferenceLinker.LinkTo(property, path)); + () => SerializeReferenceLinker.LinkTo(persistent, path)); } // Generate a new subclass of the field's type and assign it once it compiles. @@ -342,7 +342,7 @@ private static void ShowContextMenu(SerializedProperty property, Type fieldType) menu.AddItem(new GUIContent("Create New Script…"), false, () => { if (SerializeReferenceScriptCreator.TryCreateSubclassStub(fieldType, out _, out var fullTypeName)) - SerializeReferencePendingAssignment.Enqueue(property.serializedObject.targetObject, property.propertyPath, fullTypeName); + SerializeReferencePendingAssignment.Enqueue(persistent.serializedObject.targetObject, persistent.propertyPath, fullTypeName); }); // Save the current instance as a durable named template, and paste any assignable saved template. @@ -358,7 +358,7 @@ private static void ShowContextMenu(SerializedProperty property, Type fieldType) { if (fieldType != null && !fieldType.IsAssignableFrom(template.Type)) continue; var name = template.Name; - menu.AddItem(new GUIContent($"Paste Template/{name}"), false, () => ApplyTemplate(property, name)); + menu.AddItem(new GUIContent($"Paste Template/{name}"), false, () => ApplyTemplate(persistent, name)); } menu.ShowAsContext();