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

Possible to create a TweenDelayedInvoke without creating a GameObject?

lehtiniemi opened this issue · comments

I'm running Tweens in editor mode. Can I create a delayed tween and save the reference it for possible cancellation without instantiating a game object into the editor?

Hi! Not perse, an updater is required in order to run the Tween. An option would be to create a temporarily game object, and destoy it afterwards.

var _gameObject = new GameObject();
_gameObject.TweenDelayedInvoke(10, () => {
  GameObject.Destroy(_gameObject);
});

Another solution could be to use my Timers modules, which does the same but without the need of mono behaviours.