It the moment, the best way to achieve this is probably through the use of a coroutine. Something like: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.
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, Vector3.one, Vector3.zero, duration: 0.5f).Scale(Vector3.zero, Vector3.one, duration: 0.5f).GetChainRoot().Start();
yield return new WaitForSeconds(delay);
}
}