0
0
Unityframework~10 mins

WebGL build in Unity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start a WebGL build in Unity using the BuildPipeline.

Unity
BuildPipeline.BuildPlayer(scenes, outputPath, BuildTarget.[1], BuildOptions.None);
Drag options to blanks, or click blank then click option'
AStandaloneWindows
BiOS
CWebGL
DAndroid
Attempts:
3 left
💡 Hint
Common Mistakes
Using StandaloneWindows or other platform targets instead of WebGL.
Misspelling the BuildTarget value.
2fill in blank
medium

Complete the code to specify the output folder for the WebGL build.

Unity
string outputPath = "[1]";
Drag options to blanks, or click blank then click option'
ABuilds/WebGLBuild
BAssets/WebGL
CWebGL/Output
DBuild/WebGL
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Assets' folder which is for source files, not builds.
Using inconsistent folder names.
3fill in blank
hard

Fix the error in the code to build WebGL with scenes array.

Unity
string[] scenes = {"Assets/Scene1.unity", "Assets/Scene2.unity"};
BuildPipeline.BuildPlayer(scenes, outputPath, BuildTarget.[1], BuildOptions.None);
Drag options to blanks, or click blank then click option'
AWebGL
Bwebgl
CWebGl
DWEBGL
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or incorrect casing for BuildTarget.WebGL.
Typo in the BuildTarget name.
4fill in blank
hard

Fill both blanks to set build options for a development WebGL build with auto-connect profiler.

Unity
BuildOptions options = BuildOptions.[1] | BuildOptions.[2];
Drag options to blanks, or click blank then click option'
ADevelopment
BAutoConnectProfiler
CStrictMode
DNone
Attempts:
3 left
💡 Hint
Common Mistakes
Using BuildOptions.None which disables special build features.
Confusing option names or missing bitwise OR operator.
5fill in blank
hard

Fill all three blanks to create a dictionary mapping scene names to their build indices for WebGL build.

Unity
var sceneIndices = new Dictionary<string, int> {
    {"[1]", [2],
    {"[3]", 1}
};
Drag options to blanks, or click blank then click option'
AMainScene
B0
CMenuScene
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up scene names and indices.
Using incorrect indices for scenes.