It seems the NetworkServer instance is not yet active inside NetworkManager.OnStartServer, so if I am trying to call NetworkServer.Spawn inside OnStartServer, I get the following exception:
SpawnObject for xxxx (UnityEngine.GameObject), NetworkServer is not active. Cannot spawn objects without an active server.
NetworkServer seems to be only usable after the StartServer call complete finishes, so for example, the following sequence works:
However, as I am calling NetworkManager.StartServer at various places, and I have some common server object creation methods that I would like to be hooked into a common place such as OnStartServer, and I also want to spawn the objects through NetworkServer, which miserably fails.
Any suggestions on how can I get around this issue?