Page 1 of 1

How to repeat a series of transitions

Posted: Fri Jun 17, 2016 6:38 am
by mahewitt
Is there an easy way to repeat a series of transitions a certain number of times (in code)?

I'm trying to create a blink effect and I want the game object to blink sometimes for 3 seconds and sometimes for 5 seconds and sometimes for 7 seconds.
It the moment, the best way to achieve this is probably through the use of a coroutine. Something like:

Code: Select all

    StartCoroutine(Blink( this.gameObject, 5, 2))

IEnumerator Blink(GameObject gameObject, int count, float delay)
    for (var i = 0; i < count; i++) {
        new Scale(gameObject,,, duration: 0.5f).Scale(,, duration: 0.5f).GetChainRoot().Start();
        yield return new WaitForSeconds(delay);
I will look into getting a repeat method added to a future version to simplify the above, but will need a bit of thinking as to how best to handle chained calls etc..