Complete the code to load a scene named "GameScene" using Unity's SceneManager.
SceneManager.[1]("GameScene");
The LoadScene method of SceneManager loads a new scene by name or index.
Complete the code to add the UnityEngine.SceneManagement namespace needed for scene transitions.
using [1];The SceneManager class is inside the UnityEngine.SceneManagement namespace.
Fix the error in the code to load a scene asynchronously named "Level1".
SceneManager.[1]("Level1");
The correct method to load a scene asynchronously is LoadSceneAsync.
Fill both blanks to check if the current active scene's name is "Menu".
if (SceneManager.[1]().[2] == "Menu") { // do something }
GetActiveScene() returns the current scene, and name gets its name.
Fill all three blanks to create a dictionary mapping scene names to their build indexes for scenes with index less than 3.
var scenes = new Dictionary<string, int> {
{"[1]", [2]
};
for (int i = 0; i < 5; i++) {
var scene = SceneManager.GetSceneByBuildIndex(i);
if (i [3] 3) {
scenes[scene.name] = i;
}
}The dictionary starts with a scene named "Intro" and its index 0. The condition checks if i < 3.