Bird
Raised Fist0
Unityframework~20 mins

Scene loading and unloading in Unity - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Scene Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate
2:00remaining
What is the output of this scene loading code?
Consider the following Unity C# code snippet that loads a scene asynchronously. What will be printed in the console when the scene finishes loading?
Unity
using UnityEngine;
using UnityEngine.SceneManagement;

public class SceneLoader : MonoBehaviour
{
    void Start()
    {
        StartCoroutine(LoadYourAsyncScene());
    }

    System.Collections.IEnumerator LoadYourAsyncScene()
    {
        AsyncOperation asyncLoad = SceneManager.LoadSceneAsync("Level2");

        while (!asyncLoad.isDone)
        {
            yield return null;
        }

        Debug.Log("Scene Loaded");
    }
}
AScene Loaded
BNo output
CError: Scene not found
DScene Loading
Attempts:
2 left
💡 Hint
Look at when Debug.Log is called in relation to the async loading completion.
🧠 Conceptual
intermediate
1:30remaining
Which method unloads a scene in Unity?
You want to remove a scene from memory in Unity during runtime. Which method should you use?
ASceneManager.UnloadSceneAsync("SceneName")
BSceneManager.LoadScene("SceneName")
CSceneManager.ReloadScene("SceneName")
DSceneManager.AddScene("SceneName")
Attempts:
2 left
💡 Hint
Think about the method that removes a scene asynchronously.
🔧 Debug
advanced
2:00remaining
Why does this scene not unload properly?
This code tries to unload a scene but the scene remains loaded. What is the likely cause?
Unity
using UnityEngine.SceneManagement;

void UnloadScene()
{
    SceneManager.UnloadSceneAsync("GameScene");
}
AThe scene name is case sensitive and "GameScene" is incorrect
BUnloadSceneAsync requires a callback to complete unloading
CUnloadSceneAsync only works in editor mode
DThe scene is set as the active scene and cannot be unloaded
Attempts:
2 left
💡 Hint
Check if the active scene can be unloaded.
📝 Syntax
advanced
1:30remaining
Which code correctly loads a scene additively?
You want to load a scene without unloading the current one. Which code snippet is correct?
ASceneManager.LoadSceneAsync("Level3", LoadSceneMode.Single);
BSceneManager.LoadScene("Level3", LoadSceneMode.Additive);
CSceneManager.LoadSceneAdditive("Level3");
DSceneManager.LoadScene("Level3", LoadMode.Additive);
Attempts:
2 left
💡 Hint
Check the correct enum name for additive loading.
🚀 Application
expert
3:00remaining
How to ensure a scene is fully unloaded before loading another?
You want to unload "SceneA" and then load "SceneB" only after unloading completes. Which approach ensures this order?
Unity
using UnityEngine;
using UnityEngine.SceneManagement;

public class SceneSwitcher : MonoBehaviour
{
    public void SwitchScenes()
    {
        // Fill in the blanks
    }
}
A
SceneManager.LoadScene("SceneB");
SceneManager.UnloadSceneAsync("SceneA");
B
SceneManager.UnloadSceneAsync("SceneA");
SceneManager.LoadScene("SceneB");
C
StartCoroutine(UnloadThenLoad());

IEnumerator UnloadThenLoad()
{
    yield return SceneManager.UnloadSceneAsync("SceneA");
    SceneManager.LoadScene("SceneB");
}
D
SceneManager.UnloadScene("SceneA");
SceneManager.LoadSceneAsync("SceneB");
Attempts:
2 left
💡 Hint
Think about waiting for the unload operation to finish before loading.

Practice

(1/5)
1. What does loading a scene in Unity do?
easy
A. It changes what the player sees by switching or adding scenes.
B. It deletes all game objects permanently.
C. It saves the current game progress automatically.
D. It pauses the game without changing the view.

Solution

  1. Step 1: Understand scene loading purpose

    Loading a scene changes the visible content by switching or adding new scenes.
  2. Step 2: Compare other options

    Deleting objects, saving progress, or pausing are unrelated to scene loading.
  3. Final Answer:

    It changes what the player sees by switching or adding scenes. -> Option A
  4. Quick Check:

    Scene loading = change visible scenes [OK]
Hint: Loading scenes changes what player sees [OK]
Common Mistakes:
  • Confusing loading with saving game progress
  • Thinking loading deletes objects
  • Assuming loading pauses the game
2. Which of the following is the correct syntax to load a scene additively in Unity using C#?
easy
A. SceneManager.LoadScene("Level2", LoadSceneMode.Additive);
B. SceneManager.LoadSceneAdditive("Level2");
C. SceneManager.LoadScene("Level2", true);
D. SceneManager.AddScene("Level2");

Solution

  1. Step 1: Recall Unity scene loading syntax

    The correct method is LoadScene with scene name and LoadSceneMode.Additive as parameters.
  2. Step 2: Check each option

    Only SceneManager.LoadScene("Level2", LoadSceneMode.Additive); uses the correct method and enum for additive loading.
  3. Final Answer:

    SceneManager.LoadScene("Level2", LoadSceneMode.Additive); -> Option A
  4. Quick Check:

    LoadScene + LoadSceneMode.Additive = correct syntax [OK]
Hint: Use LoadScene with LoadSceneMode.Additive [OK]
Common Mistakes:
  • Using non-existent methods like LoadSceneAdditive
  • Passing boolean instead of LoadSceneMode enum
  • Confusing AddScene with LoadScene
3. What will happen if you run this code snippet in Unity?
SceneManager.LoadScene("Menu");
SceneManager.LoadScene("Game", LoadSceneMode.Additive);
medium
A. Only the "Game" scene will be loaded, replacing "Menu".
B. Only the "Menu" scene will be loaded, ignoring the second call.
C. Both "Menu" and "Game" scenes will be loaded together.
D. An error will occur because you cannot load two scenes in a row.

Solution

  1. Step 1: Understand default and additive loading

    The first call loads "Menu" scene normally (single mode), replacing current scenes. The second call loads "Game" additively, adding it without unloading "Menu".
  2. Step 2: Analyze the sequence

    Since the second call uses additive mode, both scenes "Menu" and "Game" will be loaded together.
  3. Final Answer:

    Both "Menu" and "Game" scenes will be loaded together. -> Option C
  4. Quick Check:

    Additive loading adds scene without unloading [OK]
Hint: Additive mode loads scene without unloading others [OK]
Common Mistakes:
  • Assuming first load is replaced by second always
  • Thinking additive unloads previous scenes
  • Believing multiple loads cause errors
4. Identify the error in this Unity C# code for unloading a scene:
SceneManager.UnloadScene("Level1");
medium
A. UnloadScene is deprecated; use UnloadSceneAsync with scene name.
B. UnloadSceneAsync should be used instead of UnloadScene.
C. There is no error; the code unloads the scene correctly.
D. UnloadScene requires a Scene object, not a string.

Solution

  1. Step 1: Check Unity API for unloading scenes

    SceneManager.UnloadScene requires a Scene object as parameter, not a string name. No overload accepts string directly.
  2. Step 2: Analyze the code

    The code will not compile. Correct usage: Scene scene = SceneManager.GetSceneByName("Level1"); SceneManager.UnloadScene(scene);
  3. Final Answer:

    UnloadScene requires a Scene object, not a string. -> Option D
  4. Quick Check:

    UnloadScene(Scene), not (string) [OK]
Hint: UnloadScene requires Scene object, not string [OK]
Common Mistakes:
  • Passing string name instead of Scene object
  • Thinking UnloadScene is deprecated
  • Assuming the code runs without error
5. You want to load a new scene "Battle" without unloading the current "Town" scene, but only if "Battle" is not already loaded. Which code snippet correctly does this in Unity?
hard
A. SceneManager.UnloadSceneAsync("Town"); SceneManager.LoadScene("Battle");
B. if (!SceneManager.GetSceneByName("Battle").isLoaded) { SceneManager.LoadScene("Battle", LoadSceneMode.Additive); }
C. SceneManager.LoadScene("Battle", LoadSceneMode.Single);
D. SceneManager.LoadScene("Battle");

Solution

  1. Step 1: Check if "Battle" scene is already loaded

    Use SceneManager.GetSceneByName("Battle").isLoaded to verify if scene is loaded.
  2. Step 2: Load "Battle" additively if not loaded

    If not loaded, call LoadScene with LoadSceneMode.Additive to keep "Town" scene loaded.
  3. Final Answer:

    if (!SceneManager.GetSceneByName("Battle").isLoaded) { SceneManager.LoadScene("Battle", LoadSceneMode.Additive); } -> Option B
  4. Quick Check:

    Check loaded + additive load = correct approach [OK]
Hint: Check isLoaded before additive load [OK]
Common Mistakes:
  • Loading scene in single mode, unloading current scene
  • Not checking if scene is already loaded
  • Unloading current scene before loading new one
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard