Challenge - 5 Problems
Canvas Render Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this Canvas render mode check?
Consider this Unity C# code snippet that checks the render mode of a Canvas component. What will be printed to the console?
Unity
using UnityEngine; public class CanvasCheck : MonoBehaviour { public Canvas canvas; void Start() { if (canvas.renderMode == RenderMode.ScreenSpaceOverlay) { Debug.Log("Overlay mode active"); } else if (canvas.renderMode == RenderMode.ScreenSpaceCamera) { Debug.Log("Camera mode active"); } else { Debug.Log("World space mode active"); } } }
Attempts:
2 left
💡 Hint
The default render mode for a new Canvas in Unity is Screen Space - Overlay.
✗ Incorrect
By default, a Canvas component's renderMode is set to ScreenSpaceOverlay, so the first condition is true and "Overlay mode active" is printed.
🧠 Conceptual
intermediate1:30remaining
Which Canvas render mode allows UI elements to appear in 3D space?
In Unity, which Canvas render mode lets UI elements behave like normal 3D objects in the scene, affected by lights and perspective?
Attempts:
2 left
💡 Hint
Think about which mode places UI in the actual 3D world.
✗ Incorrect
World Space mode places the Canvas as a 3D object in the scene, so UI elements behave like other 3D objects.
🔧 Debug
advanced2:30remaining
Why does this UI not appear when using Screen Space - Camera?
This code sets the Canvas render mode to Screen Space - Camera but the UI is invisible. What is the most likely cause?
Unity
Canvas canvas = GetComponent<Canvas>(); canvas.renderMode = RenderMode.ScreenSpaceCamera; // No camera assigned to canvas.worldCamera // UI elements are children of this canvas
Attempts:
2 left
💡 Hint
Screen Space - Camera mode requires a camera reference.
✗ Incorrect
When using Screen Space - Camera, the Canvas needs a camera assigned to its worldCamera property to render UI properly.
📝 Syntax
advanced2:00remaining
Which code snippet correctly sets Canvas to World Space mode and positions it?
Choose the correct C# code to set a Canvas to World Space render mode and place it at position (0, 1, 0).
Attempts:
2 left
💡 Hint
Remember the correct property names for Canvas and Transform.
✗ Incorrect
Canvas has a renderMode property. Transform position is set via transform.position with a Vector3 constructor.
🚀 Application
expert3:00remaining
How many Canvas components can be set to Screen Space - Overlay in a scene without UI overlap issues?
In Unity, if you have multiple Canvas components set to Screen Space - Overlay, how many can you have active simultaneously without UI elements overlapping unexpectedly?
Attempts:
2 left
💡 Hint
Think about how Unity handles multiple overlay canvases and their draw order.
✗ Incorrect
Unity allows multiple Screen Space - Overlay canvases; their draw order depends on the Canvas sorting order property.