From 015d0219648efcc7d831c9c5f97e94d91a3058fa Mon Sep 17 00:00:00 2001 From: yum Date: Wed, 19 Feb 2025 17:54:52 -0800 Subject: Bugfix: dragging and dropping new config updates text field --- Scripts/YOTSNDMFConfig.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Scripts/YOTSNDMFConfig.cs b/Scripts/YOTSNDMFConfig.cs index 971dd8e..a1d8bad 100644 --- a/Scripts/YOTSNDMFConfig.cs +++ b/Scripts/YOTSNDMFConfig.cs @@ -17,12 +17,18 @@ namespace YOTS [TextArea(5, 80)] // Min 5 lines, max 80 lines public string jsonContent; + [SerializeField, HideInInspector] + private TextAsset lastJsonConfig; + void OnValidate() { gameObject.tag = "EditorOnly"; - // Update jsonContent when jsonConfig changes - if (jsonConfig != null && string.IsNullOrEmpty(jsonContent)) { - jsonContent = jsonConfig.text; + // Only update jsonContent when jsonConfig actually changes + if (jsonConfig != lastJsonConfig) { + if (jsonConfig != null) { + jsonContent = jsonConfig.text; + } + lastJsonConfig = jsonConfig; } } } -- cgit v1.2.3