Mirror
Mirror copied to clipboard
Feature : makes impossible to receive messages before all the scene NetworkIdentity have been activated back.
This feature request is related to this : https://github.com/MirrorNetworking/Mirror/issues/3601
It looks like mirror client side is trying to receive message before the scene NetworkIdentities are activated back via:
NetworkClient.ApplySpawnPayload()
I tried to track the message with :
RemoteCalls.RemoteProcedureCalls.GetDelegate(msgType)
it returns me "Null"
As a result the client is disconnected.
In NetworkClient.OnTransportData()
i commented out:
connection.Disconnect();
- line 350
and added to my GameObject a debug utilitie with:
public void OnEnable(){Debug.Log("WhoActivated - OnEnable: " + gameObject.name, gameObject);}
i receive:
Unknown message id: 46251. This can happen if no handler was registered for this message.
from NetworkClient.UnpackAndInvoke()
until the GameObject is activated back, then never anymore.
So the request is: Can mirror prevent message receive until all NetworkIdentities are activated back ?
Is this related to scene changes? If so, how are you changing scenes on clients?
i change scene like this: SceneManager.LoadScene() the bug was not present in v66
If you send a SceneMessage from server to clients, or use Network Manager's ServerChangeScene method, then clients will suspend msg processing until the scene is loaded. Mirror has always been designed like this.
Frankly i don't remember exactly, it was a little while ago. But, there was a problem with Mirror enabling/disabling/enabling again the scene objects. So the gameobjects were enabled - ready to get message, disabled ( here comes the error ), enabled again. and again, i did not touch anything between my v66 and my actual version ( maybe 81 or 82).