fix: improve tweener editor

- fixed an issue in legacy versions of Unity where changes made using the seek bar were not immediately reflected on the screen
- fixed an issue where even disabled tweener objects could be controlled using the seek bar
This commit is contained in:
mob-sakai
2026-11-14 08:35:52 +09:00
parent af0ae7bdf7
commit 4a49e9a8b2
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -24,8 +24,8 @@ namespace Coffee.UIEffects.Editors
private static bool expandOthers
{
set => UIEffectEditorSettings.instance.m_ExpandOthers = value;
get => UIEffectEditorSettings.instance.m_ExpandOthers;
set => UIEffectEditorSettings.instance.m_ExpandOthers = value;
}
protected override void OnEnable()
@@ -92,6 +92,7 @@ namespace Coffee.UIEffects.Editors
{
if (tweener == null) return;
EditorGUI.BeginDisabledGroup(!tweener.enabled);
EditorGUILayout.Space(4);
GUILayout.Label(GUIContent.none, "sv_iconselector_sep", GUILayout.ExpandWidth(true));
@@ -101,6 +102,7 @@ namespace Coffee.UIEffects.Editors
if (GUI.Button(rResetTimeButton, EditorGUIUtility.IconContent("animation.firstkey"), "IconButton"))
{
ResetTime();
EditorApplication.QueuePlayerLoopUpdate();
}
var rPlayButton = new Rect(r.x + 20, r.y, 20, r.height);
@@ -148,12 +150,15 @@ namespace Coffee.UIEffects.Editors
if (EditorGUI.EndChangeCheck())
{
SetTime(time);
EditorApplication.QueuePlayerLoopUpdate();
}
if (Application.isPlaying && tweener.isActiveAndEnabled)
{
Repaint();
}
EditorGUI.EndDisabledGroup();
}
private static float DrawBackground(Rect r, float width, Color color)
@@ -168,6 +173,7 @@ namespace Coffee.UIEffects.Editors
{
foreach (var tweener in targets.OfType<UIEffectTweener>())
{
if (!tweener.enabled) continue;
tweener.SetTime(time);
}
}
@@ -176,6 +182,7 @@ namespace Coffee.UIEffects.Editors
{
foreach (var tweener in targets.OfType<UIEffectTweener>())
{
if (!tweener.enabled) continue;
tweener.ResetTime(tweener.direction);
}
}
@@ -210,6 +217,7 @@ namespace Coffee.UIEffects.Editors
_lastTime = EditorApplication.timeSinceStartup;
foreach (var tweener in targets.OfType<UIEffectTweener>())
{
if (!tweener.enabled) continue;
tweener.UpdateTime(tweener.direction == UIEffectTweener.Direction.Forward ? delta : -delta);
}