com.unity.netcode.gameobjects@2.0.0-pre.3
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Additional documentation and release notes are available at [Multiplayer Documentation](https://docs-multiplayer.unity3d.com). ## [2.0.0-pre.3] - 2024-07-23 ### Added - Added: `UnityTransport.GetNetworkDriver` and `UnityTransport.GetLocalEndpoint` methods to expose the driver and local endpoint being used. (#2978) ### Fixed - Fixed issue where deferred despawn was causing GC allocations when converting an `IEnumerable` to a list. (#2983) - Fixed issue where the realtime network stats monitor was not able to display RPC traffic in release builds due to those stats being only available in development builds or the editor. (#2979) - Fixed issue where `NetworkManager.ScenesLoaded` was not being updated if `PostSynchronizationSceneUnloading` was set and any loaded scenes not used during synchronization were unloaded. (#2971) - Fixed issue where `Rigidbody2d` under Unity 6000.0.11f1 has breaking changes where `velocity` is now `linearVelocity` and `isKinematic` is replaced by `bodyType`. (#2971) - Fixed issue where `NetworkSpawnManager.InstantiateAndSpawn` and `NetworkObject.InstantiateAndSpawn` were not honoring the ownerClientId parameter when using a client-server network topology. (#2968) - Fixed issue where internal delta serialization could not have a byte serializer defined when serializing deltas for other types. Added `[GenerateSerializationForType(typeof(byte))]` to both the `NetworkVariable` and `AnticipatedNetworkVariable` classes to assure a byte serializer is defined.(#2962) - Fixed issue when scene management was disabled and the session owner would still try to synchronize a late joining client. (#2962) - Fixed issue when using a distributed authority network topology where it would allow a session owner to spawn a `NetworkObject` prior to being approved. Now, an error message is logged and the `NetworkObject` will not be spawned prior to the client being approved. (#2962) - Fixed issue where attempting to spawn during `NetworkBehaviour.OnInSceneObjectsSpawned` and `NetworkBehaviour.OnNetworkSessionSynchronized` notifications would throw a collection modified exception. (#2962) ### Changed - Changed logic where clients can now set the `NetworkSceneManager` client synchronization mode when using a distributed authority network topology. (#2985)
This commit is contained in:
@@ -227,6 +227,11 @@ namespace Unity.Netcode
|
||||
foreach (var sceneToUnload in m_ScenesToUnload)
|
||||
{
|
||||
SceneManager.UnloadSceneAsync(sceneToUnload);
|
||||
// Update the ScenesLoaded when we unload scenes
|
||||
if (sceneManager.ScenesLoaded.ContainsKey(sceneToUnload.handle))
|
||||
{
|
||||
sceneManager.ScenesLoaded.Remove(sceneToUnload.handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,8 +333,9 @@ namespace Unity.Netcode
|
||||
public void SetClientSynchronizationMode(ref NetworkManager networkManager, LoadSceneMode mode)
|
||||
{
|
||||
var sceneManager = networkManager.SceneManager;
|
||||
// Don't let non-authority set this value
|
||||
if ((!networkManager.DistributedAuthorityMode && !networkManager.IsServer) || (networkManager.DistributedAuthorityMode && !networkManager.LocalClient.IsSessionOwner))
|
||||
// In client-server, we don't let client's set this value.
|
||||
// In distributed authority, since session owner can be promoted clients can set this value
|
||||
if (!networkManager.DistributedAuthorityMode && !networkManager.IsServer)
|
||||
{
|
||||
if (NetworkLog.CurrentLogLevel <= LogLevel.Normal)
|
||||
{
|
||||
@@ -338,7 +344,7 @@ namespace Unity.Netcode
|
||||
return;
|
||||
}
|
||||
else // Warn users if they are changing this after there are clients already connected and synchronized
|
||||
if (networkManager.ConnectedClientsIds.Count > (networkManager.IsHost ? 1 : 0) && sceneManager.ClientSynchronizationMode != mode)
|
||||
if (!networkManager.DistributedAuthorityMode && networkManager.ConnectedClientsIds.Count > (networkManager.IsHost ? 1 : 0) && sceneManager.ClientSynchronizationMode != mode)
|
||||
{
|
||||
if (NetworkLog.CurrentLogLevel <= LogLevel.Normal)
|
||||
{
|
||||
|
||||
@@ -774,6 +774,7 @@ namespace Unity.Netcode
|
||||
/// <summary>
|
||||
/// This setting changes how clients handle scene loading when initially synchronizing with the server.<br />
|
||||
/// The server or host should set this value as clients will automatically be synchronized with the server (or host) side.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <b>LoadSceneMode.Single:</b> All currently loaded scenes on the client will be unloaded and the
|
||||
/// server's currently active scene will be loaded in single mode on the client unless it was already
|
||||
@@ -2406,16 +2407,6 @@ namespace Unity.Netcode
|
||||
NetworkManager.ConnectionManager.CreateAndSpawnPlayer(NetworkManager.LocalClientId);
|
||||
}
|
||||
|
||||
// Client is now synchronized and fully "connected". This also means the client can send "RPCs" at this time
|
||||
NetworkManager.ConnectionManager.InvokeOnClientConnectedCallback(NetworkManager.LocalClientId);
|
||||
|
||||
// Notify the client that they have finished synchronizing
|
||||
OnSceneEvent?.Invoke(new SceneEvent()
|
||||
{
|
||||
SceneEventType = sceneEventData.SceneEventType,
|
||||
ClientId = NetworkManager.LocalClientId, // Client sent this to the server
|
||||
});
|
||||
|
||||
// Process any SceneEventType.ObjectSceneChanged messages that
|
||||
// were deferred while synchronizing and migrate the associated
|
||||
// NetworkObjects to their newly assigned scenes.
|
||||
@@ -2429,6 +2420,16 @@ namespace Unity.Netcode
|
||||
SceneManagerHandler.UnloadUnassignedScenes(NetworkManager);
|
||||
}
|
||||
|
||||
// Client is now synchronized and fully "connected". This also means the client can send "RPCs" at this time
|
||||
NetworkManager.ConnectionManager.InvokeOnClientConnectedCallback(NetworkManager.LocalClientId);
|
||||
|
||||
// Notify the client that they have finished synchronizing
|
||||
OnSceneEvent?.Invoke(new SceneEvent()
|
||||
{
|
||||
SceneEventType = sceneEventData.SceneEventType,
|
||||
ClientId = NetworkManager.LocalClientId, // Client sent this to the server
|
||||
});
|
||||
|
||||
OnSynchronizeComplete?.Invoke(NetworkManager.LocalClientId);
|
||||
|
||||
if (NetworkLog.CurrentLogLevel <= LogLevel.Developer)
|
||||
@@ -2436,10 +2437,7 @@ namespace Unity.Netcode
|
||||
NetworkLog.LogInfo($"[Client-{NetworkManager.LocalClientId}][Scene Management Enabled] Synchronization complete!");
|
||||
}
|
||||
// For convenience, notify all NetworkBehaviours that synchronization is complete.
|
||||
foreach (var networkObject in NetworkManager.SpawnManager.SpawnedObjectsList)
|
||||
{
|
||||
networkObject.InternalNetworkSessionSynchronized();
|
||||
}
|
||||
NetworkManager.SpawnManager.NotifyNetworkObjectsSynchronized();
|
||||
|
||||
if (NetworkManager.DistributedAuthorityMode && HasSceneAuthority() && IsRestoringSession)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user