fix: #2595 InterestManagement AddAllAuthenticatedConnectionsToObservers fat fingered from x branch which didn't have 'ready' anymore. it should be AddAllReadyServerConnectionsToObservers like before, no change in the logic.

This commit is contained in:
vis2k 2021-02-24 12:39:47 +08:00
parent f3813c41cc
commit 2ef51d03f7
2 changed files with 5 additions and 3 deletions

View File

@ -1358,13 +1358,13 @@ public static bool SpawnObjects()
// Helper function to add all server connections as observers.
// This is used if none of the components provides their own
// OnRebuildObservers function.
internal static void AddAllAuthenticatedConnectionsToObservers(NetworkIdentity identity)
internal static void AddAllReadyServerConnectionsToObservers(NetworkIdentity identity)
{
// add all server connections
foreach (NetworkConnectionToClient conn in connections.Values)
{
// only if authenticated (don't send to people during logins)
if (conn.isAuthenticated)
if (conn.isReady)
identity.AddObserver(conn);
}
@ -1388,7 +1388,7 @@ static void RebuildObserversDefault(NetworkIdentity identity, bool initialize)
// not force hidden?
if (identity.visible != Visibility.ForceHidden)
{
AddAllAuthenticatedConnectionsToObservers(identity);
AddAllReadyServerConnectionsToObservers(identity);
}
}
}

View File

@ -22,6 +22,7 @@ public virtual void SetUp()
identityA = gameObjectA.AddComponent<NetworkIdentity>();
connectionA = new NetworkConnectionToClient(0x0A, false, 0);
connectionA.isAuthenticated = true;
connectionA.isReady = true;
connectionA.identity = identityA;
NetworkIdentity.spawned[0xAA] = identityA;
@ -30,6 +31,7 @@ public virtual void SetUp()
identityB = gameObjectB.AddComponent<NetworkIdentity>();
connectionB = new NetworkConnectionToClient(0x0B, false, 0);
connectionB.isAuthenticated = true;
connectionB.isReady = true;
connectionB.identity = identityB;
NetworkIdentity.spawned[0xBB] = identityB;