using UnityEngine;
using System.Collections;
public class splash: MonoBehaviour {
void Start ()
{
StartCoroutine(TestCoroutine());
}
IEnumerator TestCoroutine()
{
yield return new WaitForSeconds(2);
Application.LoadLevel(4);
}
}
This may help you.
// Fade out time variable.
public float delayTime = 5;
public bool GameMode = false;
IEnumerator Start()
{
// If application is playing.
if(GameMode || Application.isPlaying)
{
// Starts the time to fade.
yield return new WaitForSeconds (delayTime);
// Goto the function.
Main_Menu ();
}
}
public void Main_Menu()
{
Application.LoadLevel (4);
}
If you satisfied give +1 for me.
What does the Log say?
You should try these:
Try adding the 2f to the WaitForSeconds as it takes float
yield return new WaitForSeconds(2f);
Double check the index, as it starts from 0, not 1.
So the scene 4 is actually the 5th scene in your build settings