Mirror icon indicating copy to clipboard operation
Mirror copied to clipboard

Feature : makes impossible to receive messages before all the scene NetworkIdentity have been activated back.

Open Paradoks-Studio opened this issue 1 year ago • 4 comments

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 ?

Paradoks-Studio avatar Sep 16 '23 10:09 Paradoks-Studio

Is this related to scene changes? If so, how are you changing scenes on clients?

MrGadget1024 avatar Oct 29 '23 08:10 MrGadget1024

i change scene like this: SceneManager.LoadScene() the bug was not present in v66

Paradoks-Studio avatar Oct 29 '23 22:10 Paradoks-Studio

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.

MrGadget1024 avatar Oct 30 '23 07:10 MrGadget1024

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).

Paradoks-Studio avatar Oct 30 '23 10:10 Paradoks-Studio