diff --git a/Runtime/LwguiGradient/LwguiGradient.cs b/Runtime/LwguiGradient/LwguiGradient.cs index 99284ac..83b79bd 100644 --- a/Runtime/LwguiGradient/LwguiGradient.cs +++ b/Runtime/LwguiGradient/LwguiGradient.cs @@ -126,9 +126,13 @@ public void Clear(ChannelMask channelMask = ChannelMask.All) public void DeepCopyFrom(LwguiGradient src) { - _curves = new List(); for (int c = 0; c < (int)Channel.Num; c++) - _curves.Add(new AnimationCurve()); + { + if (_curves.Count == c) + _curves.Add(new AnimationCurve()); + + _curves[c].keys = new Keyframe[0]; + } for (int c = 0; c < src._curves.Count; c++) { diff --git a/UnityEditorExtension/LwguiGradientEditor/LwguiGradientWindow.cs b/UnityEditorExtension/LwguiGradientEditor/LwguiGradientWindow.cs index 9772616..05c03df 100644 --- a/UnityEditorExtension/LwguiGradientEditor/LwguiGradientWindow.cs +++ b/UnityEditorExtension/LwguiGradientEditor/LwguiGradientWindow.cs @@ -135,6 +135,7 @@ public static void UpdateCurrentGradient(LwguiGradient newGradient, bool doDeepC // Debug.Log("Update"); _lwguiGradientWindow.Init(); _lwguiGradientWindow.Repaint(); + GUI.changed = true; } private static LwguiGradientWindow GetWindow(bool focus = true) => (LwguiGradientWindow)GetWindow(typeof(LwguiGradientWindow), true, "LWGUI Gradient Editor", focus); @@ -259,6 +260,7 @@ private void Clear() { _lwguiGradientEditor = null; _lwguiGradientWindow = null; + _lwguiGradientLibraryEditor = null; } private void RegisterEvents() diff --git a/package.json b/package.json index 6928163..2d53240 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.jasonma.lwgui", - "version": "1.18.3", + "version": "1.18.4", "displayName": "LWGUI", "description": "A Lightweight, Flexible, Powerful Shader GUI System for Unity.", "keywords": [