- Home /
NetworkMessages in UNET
Hey, I'm currently struggling with sending NetworkMessages in UNET. I'm having the scene object with a NetworkIdentity on it (none of the options (localPlayer/Server) checked). I'm spawning a lot in the scene and I need to know when it's done. So I thought about using one of the internal messages. This is the relevant part of the script I have attached to it (it's a NetworkBehaviour of course):
public override void OnStartServer()
{
base.OnStartServer();
NetworkServer.RegisterHandler(MsgType.SpawnFinished, OnSpawnFinished);
}
void OnSpawnFinished(NetworkMessage netMsg)
{
Debug.Log("Spawn Finished");
}
Unfortunately I get the error message RegisterHandler: Cannot replace system message handler 12. EDIT: According to here I am overwriting NetworkManager's internal handlers and should use its virtual methods, but unfortunately there is no virtual function for OnSpawnedfinished
I've tried using Delegates from the Dictionary NetworkServer.handlers, bt unfortunately none of them has the SpawnFinished type.