0
0
Unityframework~10 mins

Transform component (position, rotation, scale) 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 set the position of a GameObject to (0, 5, 0).

Unity
transform.[1] = new Vector3(0, 5, 0);
Drag options to blanks, or click blank then click option'
Ascale
Bposition
Crotation
DlocalPosition
Attempts:
3 left
💡 Hint
Common Mistakes
Using rotation or scale instead of position.
2fill in blank
medium

Complete the code to rotate a GameObject 90 degrees around the Y axis.

Unity
transform.[1] = Quaternion.Euler(0, 90, 0);
Drag options to blanks, or click blank then click option'
Arotation
Bposition
ClocalScale
DlocalPosition
Attempts:
3 left
💡 Hint
Common Mistakes
Using position or scale instead of rotation.
3fill in blank
hard

Fix the error in the code to double the size of a GameObject.

Unity
transform.localScale = transform.localScale [1] 2;
Drag options to blanks, or click blank then click option'
A/
B+
C-
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using + or - instead of * to scale.
4fill in blank
hard

Fill both blanks to create a dictionary of GameObject names and their Y positions, only if Y is above 0.

Unity
var positions = new Dictionary<string, float> { { [1], transform.position.[2] } };
Drag options to blanks, or click blank then click option'
AgameObject.name
Btransform.position.x
Cy
Dtransform.position.y
Attempts:
3 left
💡 Hint
Common Mistakes
Using X position or incorrect property names.
5fill in blank
hard

Fill all three blanks to create a dictionary mapping uppercase GameObject names to their scale and filter scales greater than 1.

Unity
var scales = new Dictionary<string, Vector3> { { [1], [2] } }.Where(kv => kv.Value.[3] > 1).ToDictionary(kv => kv.Key, kv => kv.Value);
Drag options to blanks, or click blank then click option'
AgameObject.name.ToUpper()
Btransform.localScale
Cx
Dtransform.position
Attempts:
3 left
💡 Hint
Common Mistakes
Using position instead of scale or wrong property names.