I’m making a 2d rpg and i’m trying to load up new scenes using a box collider in Unity 5.3, can anyone help?
Script:
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class LoadNewArea : MonoBehaviour {
public string levelToLoad;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter2D(Collider2D other) {
if (other.gameObject.tag == ("Player")) {
SceneManager.LoadScene (levelToLoad);
}
}
}