Challenge - 5 Problems
Scene Transition Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output when loading a scene asynchronously?
Consider this Unity C# code snippet that loads a scene asynchronously. What will be printed to the console?
Unity
using UnityEngine; using UnityEngine.SceneManagement; using System.Collections; public class SceneLoader : MonoBehaviour { IEnumerator Start() { AsyncOperation asyncLoad = SceneManager.LoadSceneAsync("Level2"); while (!asyncLoad.isDone) { Debug.Log($"Loading progress: {asyncLoad.progress * 100}%"); yield return null; } Debug.Log("Scene loaded!"); } }
Attempts:
2 left
💡 Hint
Remember that asyncLoad.progress goes from 0 to 0.9 before completion.
✗ Incorrect
In Unity, AsyncOperation.progress ranges from 0 to 0.9 while loading. It reaches 0.9 when loading is almost done, then isDone becomes true. So the progress logs show values up to 90%.
🧠 Conceptual
intermediate1:30remaining
Which method correctly unloads a scene in Unity?
You want to unload a scene named "Menu" to free memory. Which method call is correct?
Attempts:
2 left
💡 Hint
Look for the official method to unload scenes asynchronously.
✗ Incorrect
Unity provides SceneManager.UnloadSceneAsync to unload scenes. Other methods like RemoveScene or DeleteScene do not exist.
🔧 Debug
advanced2:00remaining
Why does this scene transition cause a freeze?
This code causes the game to freeze when transitioning scenes. What is the main reason?
Unity
using UnityEngine; using UnityEngine.SceneManagement; public class FreezeOnLoad : MonoBehaviour { void Start() { SceneManager.LoadScene("GameScene"); Debug.Log("Scene loaded"); } }
Attempts:
2 left
💡 Hint
Think about how LoadScene works and its effect on the main thread.
✗ Incorrect
SceneManager.LoadScene loads the scene synchronously by default, blocking the main thread and causing the freeze until loading finishes.
📝 Syntax
advanced2:30remaining
Which code snippet correctly implements a fade transition before loading a scene?
You want to fade out the screen before loading a new scene. Which code snippet is syntactically correct and will work?
Attempts:
2 left
💡 Hint
Remember that to wait for a coroutine, you must yield return it.
✗ Incorrect
Option D correctly yields the FadeOut coroutine before loading the scene synchronously. Option D does not wait for fade to finish. Option D incorrectly yields LoadSceneAsync without starting it as a coroutine. Option D does not yield LoadSceneAsync and does not start it as coroutine.
🚀 Application
expert3:00remaining
How to keep an object alive across scene transitions?
You want a music player object to continue playing music without restarting when changing scenes. Which code snippet achieves this?
Attempts:
2 left
💡 Hint
Look for the Unity method that prevents destruction on scene load.
✗ Incorrect
DontDestroyOnLoad marks the object to persist across scene loads. Other options either destroy the object or do unrelated scene loading/unloading.