- Home /
OnStartServer works in editor, not in build
Using Unity "5.5.2f1 Personal"
I currently have a NetworkBehaviour script (C#) that is meant to create some game pieces (i.e. ships) at startup. My intent is for the Server to create and manage these objects and for the clients to see them and their current states.
So, I have an overriden OnStartServer function in my GameManager class:
public class GameManager : NetworkBehaviour
{
static GameManager _manager = null;
public static GameManager Instance { get { return _manager; } }
ShipManager _shipManager
public override void OnStartServer()
{
base.OnStartServer();
Debug.Log("OnStartServer Running");
_shipManager.LoadShips();
}
}
The GameManager is created by a GameManagerLoader component attached to my main Camera.
The Problem:
I run in the editor, with a Network Manager and HUD, and start as "Host". All the ships are created as expected. However, when I build and start as "Host", the function OnStartServer never runs and, therefore, the startup code does not run. The same thing happens in Server Only and Client mode.
I assume this is probably some "well documented" configuration item that I am missing. But, any advice is most welcome.
i have the exact same issue :| ...did you ever find a solution?