Skip to content

Commit

Permalink
fix: Host Player Ready Race Condition (#1498)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGadget committed Feb 15, 2020
1 parent da79d69 commit 4c4a52b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Assets/Mirror/Runtime/ClientScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,15 @@ public static bool Ready(NetworkConnection conn)

if (conn != null)
{
conn.Send(new ReadyMessage());
// Set these before sending the ReadyMessage, otherwise host client
// will fail in InternalAddPlayer with null readyConnection.
ready = true;
readyConnection = conn;
readyConnection.isReady = true;

// Tell server we're ready to have a player object spawned
conn.Send(new ReadyMessage());

return true;
}
Debug.LogError("Ready() called with invalid connection object: conn=null");
Expand Down

0 comments on commit 4c4a52b

Please sign in to comment.