Bird
Raised Fist0
Unityframework~5 mins

2D camera setup in Unity - Cheat Sheet & Quick Revision

Choose your learning style10 modes available
Recall & Review
beginner
What is the main purpose of a 2D camera in Unity?
A 2D camera in Unity captures and displays the 2D game world from a specific viewpoint, controlling what the player sees on the screen.
Click to reveal answer
beginner
How do you set the camera to orthographic mode in Unity?
Select the Camera object in the scene, then in the Inspector window, set the Projection property to 'Orthographic'. This removes perspective distortion for 2D games.
Click to reveal answer
intermediate
What does the 'Size' property of an orthographic camera control?
The 'Size' property controls the half-height of the camera's view in world units. Increasing it zooms out, showing more of the scene; decreasing it zooms in.
Click to reveal answer
beginner
Why is the camera's Z position important in a 2D setup?
In 2D, the camera must be positioned on the Z-axis so it can see the 2D sprites placed on the XY plane. Usually, the camera's Z is set to -10 to look towards the origin.
Click to reveal answer
intermediate
How can you make the camera follow a player smoothly in 2D?
You can write a script that updates the camera's position to follow the player's position, often using interpolation (like Lerp) to make the movement smooth.
Click to reveal answer
Which camera projection is best for 2D games in Unity?
AOrthographic
BPerspective
CPanoramic
DVR
What happens if you increase the 'Size' property of an orthographic camera?
AThe camera zooms in
BThe camera changes color
CThe camera rotates
DThe camera zooms out
Where should the 2D camera be placed on the Z-axis to see sprites on the XY plane?
AAt Z = 10
BAt Z = -10
CAt Z = 0
DAt Z = 100
Which Unity component do you adjust to make the camera follow a player?
ACamera's Transform position
BCamera's Light component
CCamera's Audio Listener
DCamera's Collider
What is a common method to smooth camera movement when following a player?
AAdding a Rigidbody to the camera
BChanging camera's background color
CUsing Vector3.Lerp in a script
DDisabling the camera
Explain how to set up a basic 2D camera in Unity and why orthographic projection is used.
Think about how 2D games show flat images without depth.
You got /4 concepts.
    Describe a simple approach to make the camera follow a player smoothly in a 2D Unity game.
    Imagine the camera is like a friend walking behind the player without sudden jumps.
    You got /4 concepts.

      Practice

      (1/5)
      1. What is the main reason to set a Unity camera to Orthographic mode in a 2D game?
      easy
      A. It increases the camera's field of view.
      B. It removes perspective, showing objects without depth distortion.
      C. It automatically follows the player character.
      D. It enables 3D rendering with shadows.

      Solution

      1. Step 1: Understand camera modes in Unity

        Unity cameras can be set to Perspective or Orthographic. Perspective shows depth with size changes, Orthographic does not.
      2. Step 2: Identify the effect of Orthographic mode

        Orthographic mode removes perspective distortion, making objects appear the same size regardless of distance, ideal for 2D games.
      3. Final Answer:

        It removes perspective, showing objects without depth distortion. -> Option B
      4. Quick Check:

        Orthographic = No perspective distortion [OK]
      Hint: Orthographic means no depth, perfect for 2D views [OK]
      Common Mistakes:
      • Confusing orthographic with perspective mode
      • Thinking orthographic adds 3D effects
      • Assuming orthographic auto-follows player
      2. Which of the following is the correct way to set a Unity camera to orthographic mode in C#?
      easy
      A. camera.mode = Orthographic;
      B. camera.isOrthographic = true;
      C. camera.setOrthographic(true);
      D. camera.orthographic = true;

      Solution

      1. Step 1: Recall Unity Camera properties

        The Camera class has a boolean property called orthographic to switch modes.
      2. Step 2: Identify correct syntax

        The correct syntax to enable orthographic mode is camera.orthographic = true;. Other options use incorrect property names or methods.
      3. Final Answer:

        camera.orthographic = true; -> Option D
      4. Quick Check:

        Property name is orthographic [OK]
      Hint: Use camera.orthographic = true to enable orthographic mode [OK]
      Common Mistakes:
      • Using incorrect property names like isOrthographic
      • Trying to call a method instead of setting a property
      • Assigning string or enum instead of boolean
      3. Given this code snippet in Unity C#:
      Camera.main.orthographicSize = 5f;
      Debug.Log(Camera.main.orthographicSize);
      What will be printed in the console?
      medium
      A. 5
      B. 10
      C. 0
      D. Error: orthographicSize is read-only

      Solution

      1. Step 1: Understand orthographicSize property

        The orthographicSize controls half the vertical size of the camera view in world units and can be set and read.
      2. Step 2: Analyze the code output

        The code sets orthographicSize to 5f, then logs it. So the output will be 5.
      3. Final Answer:

        5 -> Option A
      4. Quick Check:

        Set orthographicSize = 5, output = 5 [OK]
      Hint: orthographicSize is half the vertical view size [OK]
      Common Mistakes:
      • Thinking orthographicSize doubles the value
      • Assuming orthographicSize is read-only
      • Confusing orthographicSize with field of view
      4. You want the camera to follow the player smoothly in 2D. Which code snippet fixes the error in this code?
      void Update() {
        Vector3 targetPos = player.transform.position;
        targetPos.z = -10;
        transform.position = targetPos;
      }
      The camera jumps abruptly instead of moving smoothly.
      medium
      A. Use Vector3.Lerp to interpolate between current and target positions.
      B. Set targetPos.z = 0 instead of -10.
      C. Call transform.Translate(targetPos) instead of setting position.
      D. Remove the z-axis assignment to let camera auto-adjust.

      Solution

      1. Step 1: Identify the problem with abrupt movement

        Directly setting transform.position to player position causes instant jumps without smooth transition.
      2. Step 2: Apply smooth movement using interpolation

        Using Vector3.Lerp blends current and target positions over time, creating smooth camera movement.
      3. Final Answer:

        Use Vector3.Lerp to interpolate between current and target positions. -> Option A
      4. Quick Check:

        Smooth follow = Vector3.Lerp [OK]
      Hint: Use Vector3.Lerp for smooth camera movement [OK]
      Common Mistakes:
      • Ignoring z-axis setting causing camera clipping
      • Using transform.Translate incorrectly
      • Removing z-axis assignment breaks camera depth
      5. You want to set up a 2D camera in Unity that shows exactly 20 units vertically and follows the player with an offset of (2, 3) units smoothly. Which code snippet correctly sets the orthographic size and follows the player with offset?
      hard
      A. camera.fieldOfView = 20f; transform.position = player.position + new Vector3(2, 3, -10);
      B. camera.orthographicSize = 20f; Vector3 target = player.position + new Vector3(2, 3, 0); transform.position = target;
      C. camera.orthographicSize = 10f; Vector3 target = player.position + new Vector3(2, 3, -10); transform.position = Vector3.Lerp(transform.position, target, 0.1f);
      D. camera.orthographicSize = 5f; transform.position = player.position + new Vector3(2, 3, -10);

      Solution

      1. Step 1: Calculate orthographicSize for 20 units vertical view

        Orthographic size is half the vertical size, so 20 units vertical means orthographicSize = 10.
      2. Step 2: Set camera position with offset and smooth follow

        Adding offset (2,3) to player position and setting z to -10 keeps camera behind. Using Vector3.Lerp smooths movement.
      3. Final Answer:

        camera.orthographicSize = 10f; Vector3 target = player.position + new Vector3(2, 3, -10); transform.position = Vector3.Lerp(transform.position, target, 0.1f); -> Option C
      4. Quick Check:

        OrthographicSize = half vertical size, smooth follow with Lerp [OK]
      Hint: OrthographicSize = half vertical view; use Lerp for smooth follow [OK]
      Common Mistakes:
      • Setting orthographicSize equal to full vertical size
      • Not using smooth interpolation for camera movement
      • Using fieldOfView instead of orthographicSize for 2D camera
      Recommended

      Ready to prove it?

      Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

      10 questions~5 mineasy hard