Hello,
I have a fast scene that plays and with objects I want to fade in and out at different times…
Simple Right…?
But I’m missing it . Here is my script:
using UnityEngine;
using System.Collections;
public class timer : MonoBehaviour {
public string next;
public float time = 8.0f;
public float time2= 26.0f;
public float time3= 45.0f;
public GameObject One;
public GameObject Two;
public float oneAlpha = 0.0f;
public float twoAlpha = 0.0f;
// Use this for initialization
void Start () {
StartCoroutine("Wait");
}
IEnumerator Wait()
{
if(WaitForSeconds(time))
{
One.GetComponent<Renderer>().material.color = new Vector4(0, 0, 0, oneAlpha);
}
if (WaitForSeconds(time2))
{
Two.GetComponent<Renderer>().material.color = new Vector4(0, 0, 0, twoAlpha);
}
if (WaitForSeconds(time3))
{
Application.LoadLevel(next);
}
}
}