- Home /
Question by
christophermrau · Apr 02, 2017 at 10:08 AM ·
unity 5editornetworkingbuildoverride
OnServerStart not being called in standalone build. Works in editor.
Unity 5.5.2f1
I have implemented an override of OnServerStart in my GameMananager class:
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<ShipManager>();
}
#region Overrides of NetworkBehaviour
public override void OnStartServer()
{
base.OnStartServer();
Debug.Log("OnStartServer Running...");
_shipManager.LoadShips();
}
#endregion
}
When I run in the editor as "Host", OnStartServer runs and my ships are created.
However, when I build and run in standalone mode, nothing happens. The log does not indicate that OnStartServer was ever called. What am I missing here?
Comment
Answer by stjernerlever · Aug 06, 2019 at 10:30 AM
Ever found a solution? I have almost the same problem.
I have a script that derives from NetworkManager and has
public override void OnStartServer()
{
base.OnStartServer();
Debug.Log("OnStartServer running...");
}
It is never called, not even in the editor (version 2018.3.5f1)