Skip to content
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,10 @@ public void Handle(ref NetworkContext context)
// Stop the client-side approval timeout coroutine since we are approved.
networkManager.ConnectionManager.StopClientApprovalCoroutine();

networkManager.ConnectionManager.ConnectedClientIds.Clear();
foreach (var clientId in ConnectedClientIds)
{
if (!networkManager.ConnectionManager.ConnectedClientIds.Contains(clientId))
// If there is any disconnect between the connection sequence of Ids vs ConnectedClients, then add the client.
if (!networkManager.ConnectionManager.ConnectedClientIds.Contains(clientId) || !networkManager.ConnectionManager.ConnectedClients.ContainsKey(clientId))
{
networkManager.ConnectionManager.AddClient(clientId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2595,30 +2595,26 @@ private void HandleSessionOwnerEvent(uint sceneEventId, ulong clientId)
case SceneEventType.SynchronizeComplete:
{
// At this point the client is considered fully "connected"
if ((NetworkManager.DistributedAuthorityMode && NetworkManager.LocalClient.IsSessionOwner) || !NetworkManager.DistributedAuthorityMode)
// Make sure we have a NetworkClient for this synchronized client
if (!NetworkManager.ConnectedClients.ContainsKey(clientId))
{
// Notify the local server that a client has finished synchronizing
OnSceneEvent?.Invoke(new SceneEvent()
{
SceneEventType = sceneEventData.SceneEventType,
SceneName = string.Empty,
ClientId = clientId
});
if (NetworkManager.ConnectedClients.ContainsKey(clientId))
{
NetworkManager.ConnectedClients[clientId].IsConnected = true;
}
NetworkManager.ConnectionManager.AddClient(clientId);
}
else
// Mark this client as being connected
NetworkManager.ConnectedClients[clientId].IsConnected = true;

// Notify the local server that a client has finished synchronizing
OnSceneEvent?.Invoke(new SceneEvent()
{
// Notify the local server that a client has finished synchronizing
OnSceneEvent?.Invoke(new SceneEvent()
{
SceneEventType = sceneEventData.SceneEventType,
SceneName = string.Empty,
ClientId = clientId
});
SceneEventType = sceneEventData.SceneEventType,
SceneName = string.Empty,
ClientId = clientId
});

// For non-authority clients in a distributed authority session, we show hidden objects,
// we distribute NetworkObjects, and then we end the scene event.
if (NetworkManager.DistributedAuthorityMode && !NetworkManager.LocalClient.IsSessionOwner)
{
// Show any NetworkObjects that are:
// - Hidden from the session owner
// - Owned by this client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ internal NetworkObject GetNetworkObjectToSpawn(uint globalObjectIdHash, ulong ow
{
if (NetworkLog.CurrentLogLevel <= LogLevel.Error)
{
NetworkLog.LogError($"Failed to create object locally. [{nameof(globalObjectIdHash)}={globalObjectIdHash}]. {nameof(NetworkPrefab)} could not be found. Is the prefab registered with {nameof(NetworkManager)}?");
NetworkLog.LogError($"Failed to create object locally. [{nameof(globalObjectIdHash)}={globalObjectIdHash}]. {nameof(NetworkPrefab)} could not be found. Is the prefab registered with {NetworkManager.name}?");
}
}
else
Expand Down
Loading