0
0
Unityframework~20 mins

Canvas and render modes in Unity - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Canvas Render Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2: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");
        }
    }
}
AOverlay mode active
BCamera mode active
CWorld space mode active
DNo output (null reference error)
Attempts:
2 left
💡 Hint
The default render mode for a new Canvas in Unity is Screen Space - Overlay.
🧠 Conceptual
intermediate
1: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?
ANone of the above
BScreen Space - Camera
CScreen Space - Overlay
DWorld Space
Attempts:
2 left
💡 Hint
Think about which mode places UI in the actual 3D world.
🔧 Debug
advanced
2: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
AScreen Space - Camera mode does not support UI elements as children.
BThe canvas.worldCamera is not assigned, so UI is not rendered.
CThe canvas.renderMode must be set to World Space for UI to show.
DThe UI elements need a CanvasGroup component to be visible.
Attempts:
2 left
💡 Hint
Screen Space - Camera mode requires a camera reference.
📝 Syntax
advanced
2: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).
A
canvas.renderMode = RenderMode.WorldSpace;
canvas.position = new Vector3(0, 1, 0);
B
canvas.mode = RenderMode.WorldSpace;
canvas.transform.position = new Vector3(0, 1, 0);
C
canvas.renderMode = RenderMode.WorldSpace;
canvas.transform.position = new Vector3(0, 1, 0);
D
canvas.renderMode = RenderMode.WorldSpace;
canvas.transform.localPosition = new Vector3(0, 1, 0);
Attempts:
2 left
💡 Hint
Remember the correct property names for Canvas and Transform.
🚀 Application
expert
3: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?
AMultiple Canvas components can be Screen Space - Overlay; their order is controlled by sorting order.
BYou cannot have any Canvas set to Screen Space - Overlay if you use World Space canvases.
COnly one Canvas can be Screen Space - Overlay to avoid overlap issues.
DScreen Space - Overlay canvases automatically merge into one, so count is irrelevant.
Attempts:
2 left
💡 Hint
Think about how Unity handles multiple overlay canvases and their draw order.