To find a random spawn point, follow these steps:
- In the Scene window, create a sphere (by navigating to GameObject | 3D Object | Sphere) sized as (2, 2, 2) at position (2, 2, 2) and apply the m_red material.
- In the Project window, create a new prefab based on your sphere by dragging the Sphere GameObject from the Hierarchy window into the Project window. Rename this new prefab Prefab-ball.
- Delete the sphere from the Hierarchy window (we don't need it now we've made our prefab).
- In the Scene window, create a new capsule (by navigating to GameObject | 3D Object | Capsule) named Capsule-spawnPoint at (3, 0.5, 3), and give it a tag of Respawn (this is one of the default tags that Unity provides):
For testing, we'll leave these Respawn points visible. For the final game, we would usually uncheck the Mesh Rendered property of each Respawn GameObject so that they are not visible to the player.
...