Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIEffectTweener PlayOnEnable Restart Method Issue #299

Closed
GID0317 opened this issue Jan 20, 2025 · 4 comments
Closed

UIEffectTweener PlayOnEnable Restart Method Issue #299

GID0317 opened this issue Jan 20, 2025 · 4 comments

Comments

@GID0317
Copy link

GID0317 commented Jan 20, 2025

Hi,

I noticed that the PlayOnEnable option in UIEffectTweener only works the first time the component is enabled and doesn't work after re-enabling it. I made a change to fix this by adding ResetTime in the OnEnable method. This way, the tween resets and starts correctly each time the component is enabled.

Here is the updated OnEnable method on UIEffectTweener.cs:

private void OnEnable()
{
    _isPaused = true;

#if UNITY_EDITOR
    if (!Application.isPlaying) return;
#endif

    ResetTime(); // Ensure the tween is reset each time the component is enabled

    switch (playOnEnable)
    {
        case PlayOnEnable.KeepDirection:
            Play();
            break;
        case PlayOnEnable.Forward:
            PlayForward();
            break;
        case PlayOnEnable.Reverse:
            PlayReverse();
            break;
    }
}

I hope this helps! This change makes it work similarly to how DotWeenPro tweener behaves. Maybe consider adding a restart option in the dropdown?

Image

Thanks!

@mob-sakai
Copy link
Owner

Thank you for your reporting!

@mob-sakai
Copy link
Owner

This feature will be implemented in the next version!

@GID0317
Copy link
Author

GID0317 commented Jan 24, 2025

Awesome, looking forward to it!

github-actions bot pushed a commit that referenced this issue Jan 26, 2025
# [5.3.0](5.2.4...5.3.0) (2025-01-26)

### Features

* `SamplingFilter.EdgeAlpha` and `SamplingFilter.EdgeLuminance` now support the `Sampling Width` property for edge width ([33b1177](33b1177))
* add `EdgeMode` feature ([eadb477](eadb477))
* add `ResetOnEnable` option for `UIEffectTweener` ([e326bb7](e326bb7)), closes [#299](#299)
* add `TransitionAutoSpeed` property ([7a765c3](7a765c3))
* add `TransitionFilter.Pattern` feature ([b57e98b](b57e98b))
@mob-sakai
Copy link
Owner

🎉 This issue has been resolved in version 5.3.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants