//Jimmy Vegas Unity Tutorial //This script will randomize your light animations public class FlameAnimations : MonoBehaviour { public int LightMode; public GameObject FlameLight; void Update () { if (LightMode == 0) { StartCoroutine (AnimateLight ()); } } IEnumerator AnimateLight () { LightMode = Random.Range (1, 4); if (LightMode == 1) { FlameLight.GetComponent ().Play ("TorchAnim1"); } if (LightMode == 2) { FlameLight.GetComponent ().Play ("TorchAnim2"); } if (LightMode == 3) { FlameLight.GetComponent ().Play ("TorchAnim3"); } yield return new WaitForSeconds (0.99f); LightMode = 0; } }