0
0
Unityframework~10 mins

Performance profiling 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 enable the Unity Profiler.

Unity
UnityEngine.Profiling.Profiler.[1] = true;
Drag options to blanks, or click blank then click option'
Aenabled
BBegin
CRecord
DStart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Record', 'Begin', or 'Start' causes a method not found error.
'Enable' is not the correct property name.
2fill in blank
easy

Fix the error in the code to correctly add a custom profiler marker.

Unity
UnityEngine.Profiling.ProfilerMarker [1] = new UnityEngine.Profiling.ProfilerMarker("MyMarker");
Drag options to blanks, or click blank then click option'
AMyMarker
BProfilerMarker
Cmarker
DmyMarker
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ProfilerMarker' as variable name shadows the class.
Using 'MyMarker' (string literal) as variable name is invalid.
3fill in blank
medium

Complete the code to disable the Unity Profiler.

Unity
UnityEngine.Profiling.Profiler.[1] = false;
Drag options to blanks, or click blank then click option'
AFinish
BPause
Cenabled
DEnd
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Pause', 'End', or 'Finish' are not valid Profiler methods.
'Stop' does not exist.
4fill in blank
hard

Fill both blanks to correctly begin and end a profiling sample with a custom marker.

Unity
var marker = new UnityEngine.Profiling.ProfilerMarker("Sample");
marker.[1]();
// code to profile
marker.[2]();
Drag options to blanks, or click blank then click option'
AAuto
BBegin
CEnd
DStart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Auto' requires a 'using' statement and no manual End.
Using 'Start' is not a valid method on ProfilerMarker.
5fill in blank
hard

Fill all three blanks to create a custom profiler marker and measure a code block.

Unity
UnityEngine.Profiling.ProfilerMarker [1] = new UnityEngine.Profiling.ProfilerMarker("[2]");
[1].[3]();
// code to profile
[1].End();
Drag options to blanks, or click blank then click option'
AcustomMarker
BCustomBlock
CBegin
DStart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Start()' instead of 'Begin()' causes errors.
Using invalid variable names or string literals as variable names.