0
0
Unityframework~10 mins

Why everything in Unity is a GameObject - Test Your Understanding

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 Unity.

Unity
GameObject myObject = new [1]("MyObject");
Drag options to blanks, or click blank then click option'
AComponent
BTransform
CGameObject
DMonoBehaviour
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Transform' instead of 'GameObject' to create a new object.
Trying to instantiate 'Component' directly.
2fill in blank
medium

Complete the code to add a component to a GameObject.

Unity
myObject.[1]<Rigidbody>();
Drag options to blanks, or click blank then click option'
AGetComponent
BAddComponent
CRemoveComponent
DFindComponent
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'GetComponent' when trying to add a new component.
Trying to use 'RemoveComponent' which does not exist.
3fill in blank
hard

Fix the error in the code to access the Transform component of a GameObject.

Unity
Transform t = myObject.[1];
Drag options to blanks, or click blank then click option'
Atransform
BTransform
CgetTransform()
DGetComponent<Transform>()
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase 'Transform' which is a type, not a property.
Trying to call 'getTransform()' which does not exist.
4fill in blank
hard

Fill both blanks to create a GameObject and add a BoxCollider component.

Unity
GameObject [1] = new GameObject("Box");
[2].AddComponent<BoxCollider>();
Drag options to blanks, or click blank then click option'
AboxObject
BmyObject
CnewObject
DgameObj
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names for creation and adding component.
Using variable names not declared in the first line.
5fill in blank
hard

Fill all three blanks to create a GameObject, add a Light component, and set its color to white.

Unity
GameObject [1] = new GameObject("LightSource");
Light [2] = [1].AddComponent<Light>();
[2].color = Color.[3];
Drag options to blanks, or click blank then click option'
AlightObj
BlightComponent
Cwhite
Dred
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing variable names between object and component.
Using an invalid color name.