From 8513970e6f71d393430a573bfb0207428998bee1 Mon Sep 17 00:00:00 2001 From: mob-sakai <12690315+mob-sakai@users.noreply.github.com> Date: Fri, 28 Feb 2025 17:37:37 +0900 Subject: [PATCH] fix: reset time button does not work correctly in the inspector when `UIEffectTweener.direction=Reverse` in the editor close #310 --- Packages/src/Editor/UIEffectTweenerEditor.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Packages/src/Editor/UIEffectTweenerEditor.cs b/Packages/src/Editor/UIEffectTweenerEditor.cs index 7e629ec..572a781 100644 --- a/Packages/src/Editor/UIEffectTweenerEditor.cs +++ b/Packages/src/Editor/UIEffectTweenerEditor.cs @@ -77,7 +77,7 @@ namespace Coffee.UIEffects.Editors var rResetTimeButton = new Rect(r.x, r.y, 20, r.height); if (GUI.Button(rResetTimeButton, EditorGUIUtility.IconContent("animation.firstkey"), "IconButton")) { - SetTime(0); + ResetTime(); } var rPlayButton = new Rect(r.x + 20, r.y, 20, r.height); @@ -149,6 +149,14 @@ namespace Coffee.UIEffects.Editors } } + private void ResetTime() + { + foreach (var tweener in targets.OfType()) + { + tweener.ResetTime(tweener.direction); + } + } + private void SetPlaying(bool enable) { if (!EditorApplication.isPlaying)