why is this script not working???
So i have made my code and i keep getting the error Assets/loAD.js(3,5): BCE0005: Unknown identifier: 'SceneManager'. while using this code function OnTriggerEnter() { SceneManager.LoadScene("gameover"); } And if it is so bad can you please rewrite i need it so when a object collides with another it will load a new scene. thanks
Answer by TBruce · May 25, 2016 at 06:26 PM
My first guess would be that you are missing
uses UnityEngine.SceneManagement;
from your directives at the top of the file. But this is only a guess as you ave not provided much to go on. If this is not the problem could you please post the whole script to help us understand what is going on?
that's the code function OnTriggerEnter() {
Scene$$anonymous$$anager.LoadScene("gameover");
}
I am assu$$anonymous$$g C#. At the very top of your class you have
using UnityEngine;
and possibly more. You need at a $$anonymous$$imum
using UnityEngine;
uses UnityEngine.Scene$$anonymous$$anagement;
Use this for Javascript/Unityscript
#pragma strict
import UnityEngine.Scene$$anonymous$$anagement;
Could you please click the tick to accept the answer if your question was answered.
Your answer
![](https://koobas.hobune.stream/wayback/20220612081549im_/https://answers.unity.com/themes/thub/images/avi.jpg)