How Do I Get Unity to Return The Total Number of Scenes in My Build?

Before Unity 5, you could use Application.levelCount to return the total number of levels or scenes in a build.

Now, I’ve tried to use SceneManager.sceneCount to return this value, but it only returns 1. However, in my Build Settings I have loaded 8 scenes. So I expect that the sceneCount would show 8.

Here is the code that I am using attached to a game object of the start scene of my game:

using UnityEngine.SceneManagement;

public class TestNErase : MonoBehaviour 
 	void Start () 
		print ("Scene Count: " + SceneManager.sceneCount);


Return the total number of scenes in my game.

I figured it out. You can use the following code:

print ("Scene Count: " + SceneManager.sceneCountInBuildSettings);