Search Unity

Scene Switch help

Discussion in 'Scripting' started by TheCodingNoob, Jan 10, 2020.

  1. TheCodingNoob

    TheCodingNoob

    Joined:
    Jan 10, 2020
    Posts:
    14
    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

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.SceneManagement
    5.  
    6. public class SceneSwitch : MonoBehaviour
    7. {
    8.  
    9.     void Ontriggerenter(Collider other)
    10.     {
    11.         SceneManager.LoadScene(1);
    12.     }
    13. }
    14.  
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    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#.
     
  3. TheCodingNoob

    TheCodingNoob

    Joined:
    Jan 10, 2020
    Posts:
    14
    I have checked the name and it is as it is supposed to but it is still not working. I'm using the 3d game kit and can't find what script may cause it.