How do i have my character switch between several levels. I used Application.Loadlevel(1); But that keeps bringing me back to the same level everytime. How do i make it go from level 1 to level 2 to level 3 and so on?
Here is my code:
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
public float speed;
public GUIText countText;
public GUIText winText;
private int count;
void Start ()
{
count = 0;
SetCountText ();
winText.text ="";
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "PickUp")
{
other.gameObject.SetActive(false);
count = count + 1;
SetCountText ();
}
}
void SetCountText ()
{
countText.text = "Count: " + count.ToString ();
if (count >= 1)
{
winText.text = "CONGRAGULATIONS!";
Application.LoadLevel(1);
}
}
}
Thank you in advance!