What will be the output of the following Unity C# script when attached to a 3D object?
using UnityEngine;
public class MoveObject : MonoBehaviour {
void Start() {
transform.position = new Vector3(1, 2, 3);
Debug.Log(transform.position);
}
}using UnityEngine; public class MoveObject : MonoBehaviour { void Start() { transform.position = new Vector3(1, 2, 3); Debug.Log(transform.position); } }
Check how Vector3 is printed in Unity's Debug.Log.
The transform.position is a Vector3 representing the 3D position. Debug.Log prints it as (x, y, z) with decimals.
Which of the following best explains why 3D expands game possibilities compared to 2D?
Think about how adding depth changes player movement and game design.
3D adds the Z-axis, allowing players to move and interact in a space with depth, which creates more complex and immersive gameplay.
What error will occur when running this Unity C# code to rotate a 3D object?
using UnityEngine;
public class RotateObject : MonoBehaviour {
void Update() {
transform.Rotate(0, 90, 0 * Time.deltaTime);
}
}using UnityEngine; public class RotateObject : MonoBehaviour { void Update() { transform.Rotate(0, 90, 0 * Time.deltaTime); } }
Look carefully at how multiplication with Time.deltaTime is applied.
The code multiplies only the z-axis rotation by Time.deltaTime, which is zero, so the y-axis rotation is always 90 degrees per frame, causing very fast rotation.
Which option contains a syntax error when initializing a Vector3 in Unity C#?
Remember how to properly create new objects in C#.
Option C misses the 'new' keyword required to create a new Vector3 instance.
Given two points in 3D space, pointA = (1, 2, 3) and pointB = (4, 6, 8), which code snippet correctly calculates the distance between them in Unity C#?
Check Unity's built-in methods for distance calculation.
Vector3.Distance is the correct method to calculate the distance between two Vector3 points in Unity.