From 31437e6ddef3ed8963631d6e2b5576eb8add07c3 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 14 Feb 2024 12:17:02 +0100 Subject: [PATCH] Fix copy/paste for UI brushes --- Source/Editor/CustomEditors/CustomEditor.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/Editor/CustomEditors/CustomEditor.cs b/Source/Editor/CustomEditors/CustomEditor.cs index a519b1da1..6ae0f0562 100644 --- a/Source/Editor/CustomEditors/CustomEditor.cs +++ b/Source/Editor/CustomEditors/CustomEditor.cs @@ -543,10 +543,11 @@ namespace FlaxEditor.CustomEditors try { string text; + var value = Values[0]; if (ParentEditor is Dedicated.ScriptsEditor) { // Script - text = JsonSerializer.Serialize(Values[0]); + text = JsonSerializer.Serialize(value); // Remove properties that should be ignored when copy/pasting data if (text == null) @@ -576,12 +577,12 @@ namespace FlaxEditor.CustomEditors else if (ScriptType.FlaxObject.IsAssignableFrom(Values.Type)) { // Object reference - text = JsonSerializer.GetStringID(Values[0] as FlaxEngine.Object); + text = JsonSerializer.GetStringID(value as FlaxEngine.Object); } else { // Default - text = JsonSerializer.Serialize(Values[0]); + text = JsonSerializer.Serialize(value, TypeUtils.GetType(Values.Type)); } Clipboard.Text = text; }