0
0
Unityframework~10 mins

Why 2D is the best starting point in Unity - 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 2D sprite in Unity.

Unity
GameObject sprite = new GameObject();
sprite.AddComponent<[1]>();
Drag options to blanks, or click blank then click option'
ASpriteRenderer
BMeshRenderer
CBoxCollider
DRigidbody
Attempts:
3 left
💡 Hint
Common Mistakes
Using MeshRenderer which is for 3D objects.
2fill in blank
medium

Complete the code to move a 2D object horizontally using the arrow keys.

Unity
float move = Input.GetAxis("Horizontal");
transform.Translate(move * [1] * Time.deltaTime, 0, 0);
Drag options to blanks, or click blank then click option'
Aspeed
BdeltaTime
CTime.fixedDeltaTime
Dgravity
Attempts:
3 left
💡 Hint
Common Mistakes
Using Time.fixedDeltaTime instead of speed.
3fill in blank
hard

Fix the error in the code to detect a 2D collision.

Unity
void OnCollisionEnter2D(Collision2D [1]) {
    Debug.Log("Collision detected");
}
Drag options to blanks, or click blank then click option'
Acol
Bcollision
Cother
Dhit
Attempts:
3 left
💡 Hint
Common Mistakes
Using a parameter name that does not match the method signature.
4fill in blank
hard

Fill both blanks to create a dictionary of 2D game objects with their names as keys.

Unity
Dictionary<string, GameObject> [1] = new Dictionary<string, GameObject>();
[2].Add("Player", playerObject);
Drag options to blanks, or click blank then click option'
AgameObjects
BplayerObject
Cobjects
Dplayer
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names for the dictionary.
5fill in blank
hard

Fill all three blanks to create a 2D vector, normalize it, and print its magnitude.

Unity
Vector2 direction = new Vector2([1], [2]);
Vector2 normalized = direction.[3]();
Debug.Log(normalized.magnitude);
Drag options to blanks, or click blank then click option'
A3
B4
Cnormalized
DNormalize
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'normalized' instead of 'Normalize' method.