Skip to content

Commit 8513970

Browse files
committed
fix: reset time button does not work correctly in the inspector when UIEffectTweener.direction=Reverse in the editor
close #310
1 parent 3f5a7dc commit 8513970

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Packages/src/Editor/UIEffectTweenerEditor.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private void DrawPlayer(UIEffectTweener tweener)
7777
var rResetTimeButton = new Rect(r.x, r.y, 20, r.height);
7878
if (GUI.Button(rResetTimeButton, EditorGUIUtility.IconContent("animation.firstkey"), "IconButton"))
7979
{
80-
SetTime(0);
80+
ResetTime();
8181
}
8282

8383
var rPlayButton = new Rect(r.x + 20, r.y, 20, r.height);
@@ -149,6 +149,14 @@ private void SetTime(float time)
149149
}
150150
}
151151

152+
private void ResetTime()
153+
{
154+
foreach (var tweener in targets.OfType<UIEffectTweener>())
155+
{
156+
tweener.ResetTime(tweener.direction);
157+
}
158+
}
159+
152160
private void SetPlaying(bool enable)
153161
{
154162
if (!EditorApplication.isPlaying)

0 commit comments

Comments
 (0)