fix: #640 InternalReplacePlayerForConnection calls SpawnObserversForConnection now too

This commit is contained in:
vis2k 2019-03-24 19:41:41 +01:00
parent a2d6317642
commit bdf12c85d0

View File

@ -686,6 +686,8 @@ public static bool AddPlayerForConnection(NetworkConnection conn, GameObject pla
// add connection to observers AFTER the playerController was set. // add connection to observers AFTER the playerController was set.
// by definition, there is nothing to observe if there is no player // by definition, there is nothing to observe if there is no player
// controller. // controller.
//
// IMPORTANT: do this in AddPlayerForConnection & ReplacePlayerForConnection!
SpawnObserversForConnection(conn); SpawnObserversForConnection(conn);
if (SetupLocalPlayerForConnection(conn, identity)) if (SetupLocalPlayerForConnection(conn, identity))
@ -777,6 +779,13 @@ internal static bool InternalReplacePlayerForConnection(NetworkConnection conn,
//NOTE: DONT set connection ready. //NOTE: DONT set connection ready.
// add connection to observers AFTER the playerController was set.
// by definition, there is nothing to observe if there is no player
// controller.
//
// IMPORTANT: do this in AddPlayerForConnection & ReplacePlayerForConnection!
SpawnObserversForConnection(conn);
if (LogFilter.Debug) Debug.Log("NetworkServer ReplacePlayer setup local"); if (LogFilter.Debug) Debug.Log("NetworkServer ReplacePlayer setup local");
if (SetupLocalPlayerForConnection(conn, playerNetworkIdentity)) if (SetupLocalPlayerForConnection(conn, playerNetworkIdentity))