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)
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.
Answer by TPorteau · Mar 15, 2021 at 12:59 PM
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.
Your answer
Follow this Question
Related Questions
Why do Clients not see hosts playertag? (Mirror networking) 1 Answer
Unity Mirror OnStartServer spawn GameObjects 1 Answer
Need some help with networking, Object reference not set to an instance of an object. 0 Answers
Mirror uses the same input for every client 0 Answers
NetworkClient Send with no Connection 0 Answers