Consider this Unity C# code snippet that sets a player's spawn position. What will be the printed position?
using UnityEngine; public class SpawnTest : MonoBehaviour { void Start() { Vector3 spawnPos = new Vector3(5, 0, 10); Debug.Log($"Spawn position: {spawnPos}"); } }
Look at how Vector3.ToString() formats the output with decimals.
The Vector3 prints with decimal points by default in Unity's Debug.Log. So (5, 0, 10) becomes (5.0, 0.0, 10.0).
You have a player prefab and a spawn point in your scene. Which code snippet correctly creates the player at the spawn point's position and rotation?
Instantiate requires the prefab and the position and rotation as parameters.
Option A uses Instantiate with prefab, position, and rotation correctly. Other options misuse Instantiate or change prefab transform directly.
Given this code, the player does not appear at the spawn point as expected. What is the cause?
public GameObject playerPrefab;
public Transform spawnPoint;
void SpawnPlayer() {
playerPrefab.transform.position = spawnPoint.position;
Instantiate(playerPrefab);
}Think about what happens when you change the prefab's transform before instantiating.
Setting position on the prefab asset does not affect the spawned instance. Instantiate creates a new object at default position unless specified.
Identify the code snippet that compiles without errors and correctly spawns a player GameObject.
Instantiate requires either 1 or 3 parameters for position and rotation.
Option C uses the correct overload with prefab, position, and rotation. Option C misses rotation, C misassigns position, A uses an invalid overload.
You want the player to respawn at the last checkpoint reached. Which approach correctly stores and uses the checkpoint position?
Think about storing position data separately from prefab and using it on respawn.
Option A correctly stores position data and uses it to instantiate player at that position. Other options misuse prefab or GameObject references.