Mirror network error : There is already a player for this connection.

Hi, I am currently adding a multiplayer mode to my game using Mirror Network. However when I create a room, and another player joins the game from another client, I get an error:

There is already a player for this connection.
UnityEngine.Logger:Log (UnityEngine.LogType,object)
Mirror.ILoggerExtensions:LogError (UnityEngine.ILogger,object) (at Assets/Mirror/Runtime/Logging/LogFactory.cs:82)
Mirror.NetworkManager:OnServerAddPlayerInternal (Mirror.NetworkConnection,Mirror.AddPlayerMessage) (at Assets/Mirror/Runtime/NetworkManager.cs:1216)
Mirror.MessagePacker/<>c__DisplayClass6_0`2<Mirror.AddPlayerMessage, Mirror.NetworkConnection>:<WrapHandler>b__0 (Mirror.NetworkConnection,Mirror.NetworkReader,int) (at Assets/Mirror/Runtime/MessagePacker.cs:120)
Mirror.NetworkConnection:TransportReceive (System.ArraySegment`1<byte>,int) (at Assets/Mirror/Runtime/NetworkConnection.cs:251)
Mirror.NetworkServer:OnDataReceived (int,System.ArraySegment`1<byte>,int) (at Assets/Mirror/Runtime/NetworkServer.cs:570)
kcp2k.KcpTransport:<Awake>b__12_5 (int,System.ArraySegment`1<byte>) (at Assets/Mirror/Runtime/Transport/KCP/MirrorTransport/KcpTransport.cs:61)
kcp2k.KcpServer/<>c__DisplayClass21_0:<Tick>b__1 (System.ArraySegment`1<byte>) (at Assets/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpServer.cs:185)
kcp2k.KcpConnection:TickAuthenticated (uint) (at Assets/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpConnection.cs:265)
kcp2k.KcpConnection:Tick () (at Assets/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpConnection.cs:285)
kcp2k.KcpServer:Tick () (at Assets/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpServer.cs:240)
kcp2k.KcpTransport:LateUpdate () (at Assets/Mirror/Runtime/Transport/KCP/MirrorTransport/KcpTransport.cs:111)

177544-capture-decran-2021-03-15-122943.png
Although I have this error, the game seems to work normally, both players can move and see each other.


I’m asking for help because I’m new to Mirror, and I have absolutely no idea where it comes from. Don’t hesitate to ask me for more details on anything, since I don’t know where it comes from I don’t know what to give you as additional information. Thank you in advance.

So I found the bug. If the player has to change the scene after logging in you have to add Online Scene and Offline Scene in the Network Manager component.

Has anyone solved this bug yet?? I am getting “There is already a player for this connection.” many times, yet above suggestion does not work.