question

connorhallman29 avatar image
connorhallman29 asked

Bug in LocalMultiplayerAgent

In playfabs MPS samples for Unity Mirror it has an UnityNetworkScript script, here, that has a bug. It say's in StartListen(),

this.GetComponent<TelepathyTransport>().port = (ushort)Port;
NetworkServer.Listen(MaxConnections);

The problem is that StartServer() gets called on the network manager before this (Either in autostartserver or by starting the server manually) which also does NetworkServer.Listen(maxConnections). This causes 3 handlers to be replaced resulting in this error.

�NetworkServer.RegisterHandler replacing handler for Mirror.ReadyMessage, id=40252. If replacement is intentional, use ReplaceHandler instead to avoid this warning. 3UnityEngine.StackTraceUtility:ExtractStackTrace () _UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) 4UnityEngine.Logger:Log (UnityEngine.LogType,object) &UnityEngine.Debug:LogWarning (object) �Mirror.NetworkServer:RegisterHandler<Mirror.ReadyMessage> (System.Action`2<Mirror.NetworkConnection, Mirror.ReadyMessage>,bool) (at C:/UnityGames/play1/Assets/OutsideResources/Mirror/Runtime/NetworkServer.cs:601) �Mirror.NetworkServer:RegisterMessageHandlers () (at C:/UnityGames/play1/Assets/OutsideResources/Mirror/Runtime/NetworkServer.cs:105) wMirror.NetworkServer:Listen (int) (at C:/UnityGames/play1/Assets/OutsideResources/Mirror/Runtime/NetworkServer.cs:124) �NetworkWaitingRoomManagerServer:StartListen () (at C:/UnityGames/play1/Assets/Networking/NetworkingScripts/NetworkWaitingRoomManagerServer.cs:106) sAgentListenerWaitingRoom:OnServerActive () (at C:/UnityGames/play1/Assets/_Scripts/AgentListenerWaitingRoom.cs:38) �PlayFab.PlayFabMultiplayerAgentAPI:ProcessAgentResponse (PlayFab.MultiplayerAgent.Model.HeartbeatResponse) (at C:/UnityGames/play1/Assets/OutsideResources/PlayFabSDK/MultiplayerAgent/PlayFabMultiplayerAgentAPI.cs:329) �PlayFab.PlayFabMultiplayerAgentAPI/<SendHeartBeatRequest>d__51:MoveNext () (at C:/UnityGames/play1/Assets/OutsideResources/PlayFabSDK/MultiplayerAgent/PlayFabMultiplayerAgentAPI.cs:265) RUnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

The solution I found to this was to disable Auto Start Server Build and then replace NetworkServer.Listen with StartServer();

sdks
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Seth Du avatar image Seth Du ♦ commented ·

I will dig into it.

0 Likes 0 ·
Seth Du avatar image
Seth Du answered

Would you submit a pull request in the repository?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dimitris-Ilias Gkanatsios avatar image
Dimitris-Ilias Gkanatsios answered

Interesting, does this occur with the sample as is? Never encountered it.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.