What I am trying to do is time a level to play until the timer ends, then it’s going to go to the real level.
It isn’t working.
What am I doing wrong?
(I am getting errors like, "You need either ), ', “, =,” and one other error.)
using UnityEngine;
using System.Collections;
public class LoadLevelREAL : MonoBehaviour
{
public string Level1;
public void OnTriggerEnter2D (Collider2D other)
{
if (other.tag == "Player")
{
StartCoroutine("MyMethod");
Application.LoadLevel (4);
}
IEnumerator MyMethod()
{
yield return new WaitForSeconds(5);
Application.LoadLevel(0);
yield return null;
}
}
}