GameManager.cs

A simple game manager system that runs on scene startup. It clones a player prefab at the first SpawnPoint found in the scene and returns that SpawnPoint's world transform.

File Access
🐞 If the scene has no SpawnPoint, FirstOrDefault returns null and FindSpawnPoint throws when accessing spawnPoint.WorldTransform.
using Sandbox;

public sealed class GameManager : GameObjectSystem, ISceneStartup
{
	public GameManager( Scene scene ) : base( scene ) { }

	void ISceneStartup.OnClientInitialize()
	{
		var player = GameObject.Clone( "prefabs/player.prefab", FindSpawnPoint() );
	}

	Transform FindSpawnPoint()
	{
		var spawnPoint = Scene.GetAll<SpawnPoint>().FirstOrDefault();

		return spawnPoint.WorldTransform;
	}
}