Level 'Example' (-1) couldn't be loaded because it has not been added to the build settings.

I am using unity serializer’s checkpoint functions to load and save my game. I have a game object that simply resumes the game or starts a new one depending on if there is a checkpoint or not. This is the code:

using UnityEngine;
using System.Collections;
using Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System.Collections.Generic;
using System;
using System.Linq;

public class LoadingScript : MonoBehaviour {

	// Use this for initialization

	void Start () {

		if (LevelSerializer.CanResume == true) {
		Debug.Log ("Canresume");
						LevelSerializer.Resume ();
				} 
		else {
			Application.LoadLevel("Title Screen");
				}
	}
	
	// Update is called once per frame

}

What happens though is that LevelSerializer.CanResume always returns true and it keeps on resuming the checkpoint and spawning more and more gameobjects. Also I keep on getting the error from the title of this question. What am I doing wrong? Thank You so much!

That message pops up when the scene you are trying to load, isn’t added to the build scenes list in the build settings.

It ended up being that my REsume() code was looping over and over again because it would spawn more and more LoadingScripts which would then load more and more I got over it by using a static bool here’s my code:

using System.Collections;
using Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System.Collections.Generic;
using System;
using System.Linq;

public class LoadingScript : MonoBehaviour {
	private static bool noneedtoload;
	// Use this for initialization

	void Start () {
		Debug.Log (noneedtoload);
		if (!noneedtoload) {
						if (LevelSerializer.CanResume == true) {
								Debug.Log ("Canresume");
				noneedtoload = true;
								LevelSerializer.Resume ();
						} else {
							
								Application.LoadLevel ("Title Screen");
						}
						
				}
	}
	
	// Update is called once per frame

}