With this timer, we can load a scene and run this timer, that if this timer reaches it’s end, another scene will be loaded.
First we need to create a countDown variable, enter value in seconds, for example if you want 3 seconds for the timer, type this:
float countDown = 3f;
Put that code before Start() (outside any methods). Than, inside Update() method, make an if statement like this:
if (countDown > 0)
countDown -= Time.deltaTime;
else
Application.LoadLevel ("StartScene");
Here is the full script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SimpleTimer : MonoBehaviour {
float countDown = 3f;
void Update () {
if (countDown > 0)
countDown -= Time.deltaTime;
else
Application.LoadLevel ("SomeScene");
}
}