You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would perform the above registration logic before StartHost & StartClient. However I found out that when using NetworkServer.UnSpawn(), HOST is not executing NetworkClient.unspawnHandlers because:
internalstaticvoidRegisterMessageHandlers(boolhostMode){// host mode client / remote client react to some messages differently.// but we still need to add handlers for all of them to avoid// 'message id not found' errors.if(hostMode){RegisterHandler<ObjectDestroyMessage>(OnHostClientObjectDestroy);RegisterHandler<ObjectHideMessage>(OnHostClientObjectHide);RegisterHandler<NetworkPongMessage>(_ =>{},false);RegisterHandler<SpawnMessage>(OnHostClientSpawn);// host mode doesn't need spawningRegisterHandler<ObjectSpawnStartedMessage>(_ =>{});// host mode doesn't need spawningRegisterHandler<ObjectSpawnFinishedMessage>(_ =>{});// host mode doesn't need state updatesRegisterHandler<EntityStateMessage>(_ =>{});}else{RegisterHandler<ObjectDestroyMessage>(OnObjectDestroy);RegisterHandler<ObjectHideMessage>(OnObjectHide);RegisterHandler<NetworkPongMessage>(NetworkTime.OnClientPong,false);RegisterHandler<NetworkPingMessage>(NetworkTime.OnClientPing,false);RegisterHandler<SpawnMessage>(OnSpawn);RegisterHandler<ObjectSpawnStartedMessage>(OnObjectSpawnStarted);RegisterHandler<ObjectSpawnFinishedMessage>(OnObjectSpawnFinished);RegisterHandler<EntityStateMessage>(OnEntityStateMessage);}// These handlers are the same for host and remote clientsRegisterHandler<TimeSnapshotMessage>(OnTimeSnapshotMessage,false);// unreliable may arrive before reliable authority went throughRegisterHandler<ChangeOwnerMessage>(OnChangeOwner);RegisterHandler<RpcMessage>(OnRPCMessage);}
There is no NetworkClient.unspawnHandlers execution logic inside the 2 methods that HOST executes in response to ObjectDestroyMessage and ObjectHideMessage.
The HOST owns a client, which means that it cannot respond to the delegate methods carried by custom-registered network prefabs when UnSpawn
The text was updated successfully, but these errors were encountered:
…awnInternal
- Fixes#3962
There may be a custom unspawn handler for the prefab and NetworkClient::OnHostClientObjectDestroy doesn't invoke it and can't because it's already out of spawned dictionary.
I would perform the above registration logic before StartHost & StartClient. However I found out that when using NetworkServer.UnSpawn(), HOST is not executing NetworkClient.unspawnHandlers because:
There is no NetworkClient.unspawnHandlers execution logic inside the 2 methods that HOST executes in response to ObjectDestroyMessage and ObjectHideMessage.
The HOST owns a client, which means that it cannot respond to the delegate methods carried by custom-registered network prefabs when UnSpawn
The text was updated successfully, but these errors were encountered: