0
0
Unityframework~10 mins

Scene hierarchy window 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 create a new GameObject in the scene hierarchy.

Unity
GameObject newObject = new GameObject([1]);
Drag options to blanks, or click blank then click option'
A"MyObject"
BMyObject
Cnew GameObject()
Dnull
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the name string.
Passing an object instead of a string.
2fill in blank
medium

Complete the code to set the parent of a GameObject in the scene hierarchy.

Unity
childObject.transform.[1] = parentObject.transform;
Drag options to blanks, or click blank then click option'
ASetParent()
Bparent
CparentTransform
DparentObject
Attempts:
3 left
💡 Hint
Common Mistakes
Using a method instead of a property.
Trying to assign a GameObject instead of a Transform.
3fill in blank
hard

Fix the error in the code to correctly find a GameObject by name in the scene hierarchy.

Unity
GameObject found = GameObject.[1]("Player");
Drag options to blanks, or click blank then click option'
AFind
BFindWithTag
CFindGameObjectWithTag
DFindObjectOfType
Attempts:
3 left
💡 Hint
Common Mistakes
Using tag-based find methods when searching by name.
Using FindObjectOfType which searches by component type.
4fill in blank
hard

Fill both blanks to create a child GameObject and set its parent in the hierarchy.

Unity
GameObject child = new GameObject([1]);
child.transform.[2] = parent.transform;
Drag options to blanks, or click blank then click option'
A"ChildObject"
BSetParent()
Cparent
D"ParentObject"
Attempts:
3 left
💡 Hint
Common Mistakes
Using SetParent() method incorrectly.
Assigning a GameObject instead of a Transform as parent.
5fill in blank
hard

Fill all three blanks to create a GameObject, set its parent, and rename it in the hierarchy.

Unity
GameObject obj = new GameObject([1]);
obj.transform.[2] = parent.transform;
obj.name = [3];
Drag options to blanks, or click blank then click option'
A"NewObject"
Bparent
C"RenamedObject"
DSetParent()
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing SetParent() method with the parent property.
Forgetting quotes around string names.