Hi, I am very new to Unity and C#. I am making a 2d platformer. This same error message comes up when the player hits a killzone: Scene 'Assets/First Level (1).unity' (-1) 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...
I have tried adding a scene to the build settings and have come up with no luck. Here is the code that I am using:
using System;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace UnityStandardAssets._2D
{
public class Restarter : MonoBehaviour
{
private void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Player")
{
SceneManager.LoadScene(SceneManager.GetSceneAt(0).path);
}
}
}
}
Help would be appreciated.
↧