Consider a Unity project with three scenes added to the Build Settings in this order: Menu, Level1, and Level2. The first scene is set as the default scene to load on game start.
What scene will be loaded first when the game runs?
Check which scene is at index 0 in the Build Settings list.
The first scene in the Build Settings list (index 0) is the one Unity loads automatically when the game starts. Here, Menu is first, so it loads first.
In Unity, if you call SceneManager.LoadScene(1), which scene will load?
Assume the Build Settings have scenes in this order: Intro (index 0), Game (index 1), Credits (index 2).
Scene indices correspond to their order in Build Settings starting at 0.
SceneManager.LoadScene(1) loads the scene at index 1 in Build Settings, which is 'Game'.
Given this code snippet in Unity:
using UnityEngine;
using UnityEngine.SceneManagement;
public class TestScene : MonoBehaviour {
void Start() {
SceneManager.LoadScene("MissingScene");
}
}Assuming MissingScene is not added to Build Settings, what will happen when this runs in a built game?
Think about what happens if a scene name is not found in the build.
If a scene is not included in Build Settings, Unity cannot load it by name at runtime and throws a runtime error.
If your Unity Build Settings list contains these scenes in order: Start, LevelA, LevelB, End, how many scenes does SceneManager.sceneCountInBuildSettings return?
Count all scenes listed in Build Settings.
SceneManager.sceneCountInBuildSettings returns the total number of scenes listed in Build Settings, which is 4 here.
Which statement about the order of scenes in Unity Build Settings is correct?
Think about what Build Settings controls for scenes in a build.
All scenes added to Build Settings are included in the build. The order only sets their index used for loading scenes by index.