From 8d4f6915d16c682bbc9063bf37e0ff775b914c63 Mon Sep 17 00:00:00 2001 From: Paul Pacheco Date: Thu, 28 Jun 2018 08:50:13 -0500 Subject: [PATCH] Make the logic simpler for ensuring the connection is ready --- .../Runtime/ClientScene.cs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Unity-Technologies-networking/Runtime/ClientScene.cs b/Unity-Technologies-networking/Runtime/ClientScene.cs index d977d3206..5496d92b7 100644 --- a/Unity-Technologies-networking/Runtime/ClientScene.cs +++ b/Unity-Technologies-networking/Runtime/ClientScene.cs @@ -165,20 +165,18 @@ public static bool AddPlayer(NetworkConnection readyConn, short playerController } // ensure valid ready connection - if (readyConn == null) - { - if (!s_IsReady) - { - if (LogFilter.logError) { Debug.LogError("Must call AddPlayer() with a connection the first time to become ready."); } - return false; - } - } - else + if (readyConn != null) { s_IsReady = true; s_ReadyConnection = readyConn; } + if (!s_IsReady) + { + if (LogFilter.logError) { Debug.LogError("Must call AddPlayer() with a connection the first time to become ready."); } + return false; + } + PlayerController existingPlayerController; if (s_ReadyConnection.GetPlayerController(playerControllerId, out existingPlayerController)) {