Hi, I’m trying to get a script and block combination to work to switch screens but it just says " Can’t add script behavior Assambalyinfo.cl The script needs to derive from MonoBehavior! " how do I fix it?
This is the code I have. I’m using Microsoft visual studio to code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement
public class SceneSwitch : MonoBehaviour
{
void Ontriggerenter(Collider other)
{
SceneManager.LoadScene(1);
}
}
This script’s filename needs to be exactly “SceneSwitch.cs”. You’re getting an error with another filename, so it either is another script that is causing the problem or you have this script saved with the wrong filename.
Also, your OnTriggerEnter will not be called because you have incorrect capitalization. Capitalization is important in C#.