0
0
Unityframework~20 mins

Scene hierarchy window in Unity - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Scene Hierarchy 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 Unity C# script affecting the hierarchy?
Consider the following Unity C# script attached to a GameObject in a scene. What will be printed in the Console when the scene starts?
Unity
using UnityEngine;

public class HierarchyTest : MonoBehaviour {
    void Start() {
        Debug.Log(transform.childCount);
        foreach (Transform child in transform) {
            Debug.Log(child.name);
        }
    }
}
AThe number of children of the GameObject, followed by each child's name on a new line
B0
CNullReferenceException at runtime
DThe name of the GameObject only
Attempts:
2 left
💡 Hint
Think about what transform.childCount returns and how foreach over transform works.
🧠 Conceptual
intermediate
1:30remaining
Which statement about the Scene Hierarchy window is true?
Select the correct statement about the Unity Scene Hierarchy window.
AIt shows GameObjects from all loaded scenes combined.
BIt only shows GameObjects that are active in the scene.
CIt shows all GameObjects in the current scene including inactive ones.
DIt allows editing of GameObject components directly.
Attempts:
2 left
💡 Hint
Think about whether inactive GameObjects appear in the hierarchy.
🔧 Debug
advanced
2:30remaining
Why does this code not find a child GameObject in the hierarchy?
This code tries to find a child GameObject named "Enemy" but always returns null. Why? GameObject enemy = transform.Find("Enemy").gameObject;
AThe code should use GameObject.Find instead of transform.Find.
BThe child "Enemy" is nested deeper than one level, so transform.Find("Enemy") returns null.
CThe child "Enemy" is inactive, so transform.Find cannot find it.
DThe child "Enemy" does not exist in the scene at all.
Attempts:
2 left
💡 Hint
Remember how transform.Find works with paths and direct children.
📝 Syntax
advanced
2:00remaining
Which code snippet correctly moves a GameObject under a new parent in the hierarchy?
Select the correct code to set the parent of a GameObject named "child" to another GameObject named "parent".
Achild.transform.SetParent(parent.transform);
Bchild.parent = parent.transform;
Cchild.transform.SetParent(parent);
Dchild.transform.parent = parent.transform;
Attempts:
2 left
💡 Hint
Check the correct method and parameter type for setting a parent transform.
🚀 Application
expert
3:00remaining
How many GameObjects will be active in the scene after this code runs?
Given a GameObject "Root" with 3 children: "A" (active), "B" (inactive), and "C" (active). The code below runs: foreach (Transform child in root.transform) { child.gameObject.SetActive(false); } root.SetActive(true);
A4
B3
C0
D1
Attempts:
2 left
💡 Hint
Remember what SetActive does to children and the parent separately.