I have made a script that when you collide into a block (invisible block) it triggers the game to say ‘level complete’ and load the next level. This was working before but then suddenly it just stopped working and ruined the whole game. When i collide into the block now it does trigger the level complete text but doesn’t actually move onto the next level and gives me an error saying i have to put the scene into build settings (which i have done and is ticking in build settings with all the other scenes). This is the script:
[ using System.Collections;
using UnityEngine.SceneManagement;
using UnityEngine;
public class MoveScene : MonoBehaviour
{
[SerializeField] private string loadlevel;
void OnTriggerEnter(Collider other)
{
if (other.CompareTag(“Finish“))
{
SceneManager.LoadScene(loadlevel);
}
}
} ]
[/code]
This is the error:
Scene ‘3’ couldn’t be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.
To add a scene to the build settings use the menu File->Build Settings…
UnityEngine.SceneManagement.SceneManager:LoadScene(String)
MoveScene:OnTriggerEnter(Collider) (at Assets/MoveScene.cs:13)
P.S: I have put it in the build settings and is assigned with a tick next to it but however it says something about AssetBundle with i have no idea of what it is.