Complete the code to set the build target to Android.
UnityEditor.EditorUserBuildSettings.activeBuildTarget = BuildTarget.[1];BuildTarget.iOS instead of AndroidThe activeBuildTarget property sets the platform for the build. Here, BuildTarget.Android sets it to Android.
Complete the code to add a scene to the build settings.
var scene = new UnityEditor.EditorBuildSettingsScene("Assets/Scenes/Main.unity", [1]); UnityEditor.EditorBuildSettings.scenes = new UnityEditor.EditorBuildSettingsScene[] { scene };
false which disables the scenenull instead of a booleanThe second parameter in EditorBuildSettingsScene indicates if the scene is enabled in the build. Use true to include it.
Fix the error in setting the build path for the build player.
UnityEditor.BuildPipeline.BuildPlayer(scenes, [1], BuildTarget.StandaloneWindows64, BuildOptions.None);
The second argument must be a string path where the build will be saved. Use a string like "Builds/MyGame.exe".
Fill both blanks to create a build player with scenes and set the build target to WebGL.
string[] scenes = { "Assets/Scenes/Start.unity", "Assets/Scenes/Game.unity" };
UnityEditor.BuildPipeline.BuildPlayer(scenes, [1], BuildTarget.[2], BuildOptions.None);The build path should be a string folder for the WebGL build, and the build target must be BuildTarget.WebGL.
Fill all four blanks to create a build player with enabled scenes, set the build target to iOS, and specify the build path.
var scenes = new UnityEditor.EditorBuildSettingsScene[] {
new UnityEditor.EditorBuildSettingsScene("Assets/Scenes/Menu.unity", [1]),
new UnityEditor.EditorBuildSettingsScene("Assets/Scenes/Level1.unity", [2])
};
UnityEditor.EditorBuildSettings.scenes = scenes;
UnityEditor.BuildPipeline.BuildPlayer(scenes.Select(s => s.path).ToArray(), [3], BuildTarget.[4], BuildOptions.None);falseBoth scenes should be enabled (true), and the build path should be a string folder for the iOS build.