Unity 5.5.2f1
Build for Windows (.exe)
I have a GameManager derived from NetworkBehavior that overrides OnStartServer:
public class GameManager : NetworkBehaviour
{
static GameManager _manager = null;
public static GameManager Instance { get { return _manager; } }
ShipManager _shipManager;
void Awake()
{
if (_manager == null) _manager = this;
else if(_manager != this) Destroy(gameObject);
DontDestroyOnLoad(gameObject);
_shipManager = GetComponent();
}
#region Overrides of NetworkBehaviour
public override void OnStartServer()
{
base.OnStartServer();
Debug.Log("OnStartServer running");
_shipManager.LoadShips();
}
#endregion
}
I run in the editor and select "Host", OnStartServer is called, all my ships are created, and everything seems to run fine.
However, when I build and run in standalone, the OnStartServer function never runs and my ships are never created. Does anyone have any pointers? What am I missing here? Thanks.
↧