jeffreylanters / unity-tweens

An extremely light weight, extendable and customisable tweening engine made for strictly typed script-based animations for user-interfaces and world-space objects optimised for all platforms.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Awaitable tweens

f1yingbanana opened this issue · comments

Tweens 3.0 looks shiny! It'd be nice if it still supports Tasks like it did in 2.0 though. Completion handlers are okay but they break the logic flow a bit 🌵

Hi! Thank you for your suggestion, I've added it to the development list and will pick it up soon! 🙌🏼

Hi! I've added support for await tweens using Async and Enumerators back to version 3.4.0!

https://github.com/jeffreylanters/unity-tweens/releases/tag/v3.4.0

public class Test : MonoBehaviour {
    readonly PositionXTween tween = new() {
        from = 0,
        to = 10,
        duration = 1
    };

    async void Test1() {
        var instance = gameObject.AddTween(tween);
        await instance.AwaitDecommissionAsync();
    }

    IEnumerator Test2() {
        var instance = gameObject.AddTween(tween);
        yield return instance.AwaitDecommission();
    }
}