Game Development
Build Settings in depth
Learn the platform and scene settings of Build Settings.
Build Settings and the scene list
The game building process in Unity is managed from the File > Build Settings window. The Scenes In Build list specifies the scenes included in the final game and their respective build indices.
// Scene with index 0 is the initial scene loaded on launch
int totalScenes = SceneManager.sceneCountInBuildSettings;
SceneManager.LoadScene(0);
Scenes omitted from this list are excluded from the output build and cannot be loaded via script.
Switching platforms and Development Build
To target a different operating system, click the Switch Platform button at the bottom left. This re-imports textures and audio into the target platform's formats.
// Debug logs stay active when Development Build is enabled
#if DEVELOPMENT_BUILD
Debug.Log("Development build is active");
#endif
During testing, Development Build and Autoconnect Profiler flags are checked for profiling support.
Exercise Print first scene and scene count
Print the first scene (Index 0) and the total number of scenes (scenes.Length) formatted as "Ilk: GirisSahnesi | Toplam: 3" using Console.WriteLine.
Show example solution
using System;
class SceneBuildList
{
static void Main()
{
string[] scenes = { "GirisSahnesi", "Bolum1", "Bolum2" };
Console.WriteLine($"Ilk: {scenes[0]} | Toplam: {scenes.Length}");
}
}
Test yourself
-
What is the key characteristic of the scene at Index 0 in the 'Scenes In Build' list?
- It is a persistent UI scene that can never be unloaded from memory
- It is a developer test scene that runs only in editor play mode
- It is the initial scene automatically loaded when the game launches
- It is the scene that was last saved and modified in the project
Show answer
It is the initial scene automatically loaded when the game launches — The scene situated at Index 0 is the entry scene automatically opened by the engine when the standalone game starts.
-
Get build scene count
int sceneCount = UnityEngine.SceneManagement.SceneManager.____;
Show answer
int sceneCount = UnityEngine.SceneManagement.SceneManager.sceneCountInBuildSettings;
-
Build Settings concepts
- Scenes In Build
- List of scenes included in build
- Index 0
- First scene loaded when game starts
- Switch Platform
- Re-imports assets for target platform
- Development Build
- Adds debug symbols and logs to build
Next lesson: Player Settings