diff options
| author | yum <yum.food.vr@gmail.com> | 2025-02-19 17:54:52 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-02-19 17:54:52 -0800 |
| commit | 015d0219648efcc7d831c9c5f97e94d91a3058fa (patch) | |
| tree | fd12eb4a3551ef4a95a1b8492bac5a079fa2416b /Scripts | |
| parent | a892f8feba3dc7a35f347cc61cd54a1f41a5abd6 (diff) | |
Bugfix: dragging and dropping new config updates text field
Diffstat (limited to 'Scripts')
| -rw-r--r-- | Scripts/YOTSNDMFConfig.cs | 12 |
1 files 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;
}
}
}
|
