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
Wanted to share an issue I had while modifying the UnityMirror project where I kept getting “Unknown message id: 12345.”
Representative error messages:
{"log":"Unknown message id: 12345 for connection: connection(1). This can happen if no handler was registered for this message.", "stream":"stdout", "time":"2022-10-01T21:00:52.8479661Z"}
{"log":"NetworkServer: failed to unpack and invoke message. Disconnecting 1.", "stream":"stdout", "time":"2022-10-01T21:00:52.8481193Z"}
{"log":"Server.Disconnect connectionId:1", "stream":"stdout", "time":"2022-10-01T21:00:52.8543347Z"}
However, I had a handler registered. Further confusing the matter, I was sending several messages in a loop, so all of them printed this message on the server… but each of them had different message IDs reported.
In expanding the example, I added a new message to both UnityNetworkServer and NewNetworkManager. I manually created the identically-named struct in both the client and on the server. The server repeatedly threw the error.
The root cause is that the server code is inside a namespace, and the client is not, and that affects the underlying hash inside Mirror's call to GetId.
I'm not far enough to know whether the Maintenance or Shutdown handlers work on the client, but I did have to unify how I am naming my custom message. I did this by creating my message outside of the namespace bracket (so adding "Mirror." to qualify the NetworkMessage class in the struct declaration) in the UnityNetworkServer code.
I suggest adding a comment to either UnityNetworkServer.cs or NewNetworkServer.cs indicating where to place new messages. If I later find out the Maintenance or Shutdown handlers break as presented, I'll post again.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Wanted to share an issue I had while modifying the UnityMirror project where I kept getting “Unknown message id: 12345.”
Representative error messages:
{"log":"Unknown message id: 12345 for connection: connection(1). This can happen if no handler was registered for this message.", "stream":"stdout", "time":"2022-10-01T21:00:52.8479661Z"}
{"log":"NetworkServer: failed to unpack and invoke message. Disconnecting 1.", "stream":"stdout", "time":"2022-10-01T21:00:52.8481193Z"}
{"log":"Server.Disconnect connectionId:1", "stream":"stdout", "time":"2022-10-01T21:00:52.8543347Z"}
However, I had a handler registered. Further confusing the matter, I was sending several messages in a loop, so all of them printed this message on the server… but each of them had different message IDs reported.
In expanding the example, I added a new message to both UnityNetworkServer and NewNetworkManager. I manually created the identically-named struct in both the client and on the server. The server repeatedly threw the error.
The root cause is that the server code is inside a namespace, and the client is not, and that affects the underlying hash inside Mirror's call to GetId.
I'm not far enough to know whether the Maintenance or Shutdown handlers work on the client, but I did have to unify how I am naming my custom message. I did this by creating my message outside of the namespace bracket (so adding "Mirror." to qualify the NetworkMessage class in the struct declaration) in the UnityNetworkServer code.
I suggest adding a comment to either UnityNetworkServer.cs or NewNetworkServer.cs indicating where to place new messages. If I later find out the Maintenance or Shutdown handlers break as presented, I'll post again.
Thanks for sharing this project and cheers
Beta Was this translation helpful? Give feedback.
All reactions