Unity Unity 2 — Questions and Answers
Question 1: Which Unity callback runs once per frame and is best for non-physics movement?
- FixedUpdate()
- Update() (Correct answer)
- Awake()
- OnEnable()
Correct answer: Update()
Update() is called once per frame and is the standard place for frame-based logic and input.
Question 2: What does Time.deltaTime represent?
- Total runtime in seconds
- Seconds since the last frame (Correct answer)
- Frames per second
- Fixed physics timestep
Correct answer: Seconds since the last frame
Time.deltaTime is the time in seconds it took to complete the last frame, used to make movement frame-rate independent.
Question 3: Which component is required for a GameObject to be affected by Unity's physics gravity?
- Collider
- Transform
- Rigidbody (Correct answer)
- MeshRenderer
Correct answer: Rigidbody
A Rigidbody component allows a GameObject to be controlled by the physics engine, including gravity.
Question 4: What is the purpose of a Prefab in Unity?
- A reusable GameObject template stored as an asset (Correct answer)
- A compiled C# script
- A lighting baking method
- A type of camera
Correct answer: A reusable GameObject template stored as an asset
A Prefab is a reusable asset that stores a GameObject with its components and properties for instantiation.
Question 5: Which method instantiates a copy of an object at runtime?
- Destroy()
- Instantiate() (Correct answer)
- Clone()
- Spawn()
Correct answer: Instantiate()
Instantiate() creates a copy of a GameObject or Prefab during play.
Question 6: In which space does the Transform.localPosition operate?
- World space
- Screen space
- Relative to the parent transform (Correct answer)
- Viewport space
Correct answer: Relative to the parent transform
localPosition is the position relative to the parent transform's coordinate system.
Question 7: Which Unity class is used to detect keyboard and mouse input in the legacy input system?
- Input (Correct answer)
- Controls
- Keyboard
- EventSystem
Correct answer: Input
The legacy Input class provides methods like Input.GetKey and Input.GetAxis for reading input.
Which Unity callback runs once per frame and is best for non-physics movement?