I’m having trouble switching scenes using a 2d box collider in unity.
This is the script on the box collider.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class loadNewArea : MonoBehaviour
{
public string levelToLoad;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.name == "Player")
{
SceneManager.LoadScene(levelToLoad);
} ;
}
}
It shows in inspector it’s grey’d out and will not let me change it’s value to tell it what level to load.
There are no issues to stop from building and running the game.