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:
@@ -94,18 +94,18 @@ namespace Unity.Netcode
|
||||
{
|
||||
case NetworkListEvent<T>.EventType.Add:
|
||||
{
|
||||
NetworkVariableSerialization<T>.Write(writer, ref element.Value);
|
||||
NetworkVariableSerialization<T>.Serializer.Write(writer, ref element.Value);
|
||||
}
|
||||
break;
|
||||
case NetworkListEvent<T>.EventType.Insert:
|
||||
{
|
||||
BytePacker.WriteValueBitPacked(writer, element.Index);
|
||||
NetworkVariableSerialization<T>.Write(writer, ref element.Value);
|
||||
NetworkVariableSerialization<T>.Serializer.Write(writer, ref element.Value);
|
||||
}
|
||||
break;
|
||||
case NetworkListEvent<T>.EventType.Remove:
|
||||
{
|
||||
NetworkVariableSerialization<T>.Write(writer, ref element.Value);
|
||||
NetworkVariableSerialization<T>.Serializer.Write(writer, ref element.Value);
|
||||
}
|
||||
break;
|
||||
case NetworkListEvent<T>.EventType.RemoveAt:
|
||||
@@ -116,7 +116,7 @@ namespace Unity.Netcode
|
||||
case NetworkListEvent<T>.EventType.Value:
|
||||
{
|
||||
BytePacker.WriteValueBitPacked(writer, element.Index);
|
||||
NetworkVariableSerialization<T>.Write(writer, ref element.Value);
|
||||
NetworkVariableSerialization<T>.Serializer.Write(writer, ref element.Value);
|
||||
}
|
||||
break;
|
||||
case NetworkListEvent<T>.EventType.Clear:
|
||||
@@ -133,13 +133,13 @@ namespace Unity.Netcode
|
||||
{
|
||||
if (m_NetworkManager.DistributedAuthorityMode)
|
||||
{
|
||||
writer.WriteValueSafe(NetworkVariableSerialization<T>.Type);
|
||||
if (NetworkVariableSerialization<T>.Type == CollectionItemType.Unmanaged)
|
||||
writer.WriteValueSafe(NetworkVariableSerialization<T>.Serializer.Type);
|
||||
if (NetworkVariableSerialization<T>.Serializer.Type == NetworkVariableType.Unmanaged)
|
||||
{
|
||||
// Write the size of the unmanaged serialized type as it has a fixed size. This allows the CMB runtime to correctly read the unmanged type.
|
||||
var placeholder = new T();
|
||||
var startPos = writer.Position;
|
||||
NetworkVariableSerialization<T>.Write(writer, ref placeholder);
|
||||
NetworkVariableSerialization<T>.Serializer.Write(writer, ref placeholder);
|
||||
var size = writer.Position - startPos;
|
||||
writer.Seek(startPos);
|
||||
BytePacker.WriteValueBitPacked(writer, size);
|
||||
@@ -148,7 +148,7 @@ namespace Unity.Netcode
|
||||
writer.WriteValueSafe((ushort)m_List.Length);
|
||||
for (int i = 0; i < m_List.Length; i++)
|
||||
{
|
||||
NetworkVariableSerialization<T>.Write(writer, ref m_List.ElementAt(i));
|
||||
NetworkVariableSerialization<T>.Serializer.Write(writer, ref m_List.ElementAt(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,9 +158,9 @@ namespace Unity.Netcode
|
||||
m_List.Clear();
|
||||
if (m_NetworkManager.DistributedAuthorityMode)
|
||||
{
|
||||
// Collection item type is used by the CMB rust service, drop value here.
|
||||
reader.ReadValueSafe(out CollectionItemType type);
|
||||
if (type == CollectionItemType.Unmanaged)
|
||||
SerializationTools.ReadType(reader, NetworkVariableSerialization<T>.Serializer);
|
||||
// Collection item type is used by the DA server, drop value here.
|
||||
if (NetworkVariableSerialization<T>.Serializer.Type == NetworkVariableType.Unmanaged)
|
||||
{
|
||||
ByteUnpacker.ReadValueBitPacked(reader, out int _);
|
||||
}
|
||||
@@ -169,7 +169,7 @@ namespace Unity.Netcode
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var value = new T();
|
||||
NetworkVariableSerialization<T>.Read(reader, ref value);
|
||||
NetworkVariableSerialization<T>.Serializer.Read(reader, ref value);
|
||||
m_List.Add(value);
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ namespace Unity.Netcode
|
||||
case NetworkListEvent<T>.EventType.Add:
|
||||
{
|
||||
var value = new T();
|
||||
NetworkVariableSerialization<T>.Read(reader, ref value);
|
||||
NetworkVariableSerialization<T>.Serializer.Read(reader, ref value);
|
||||
m_List.Add(value);
|
||||
|
||||
if (OnListChanged != null)
|
||||
@@ -215,7 +215,7 @@ namespace Unity.Netcode
|
||||
{
|
||||
ByteUnpacker.ReadValueBitPacked(reader, out int index);
|
||||
var value = new T();
|
||||
NetworkVariableSerialization<T>.Read(reader, ref value);
|
||||
NetworkVariableSerialization<T>.Serializer.Read(reader, ref value);
|
||||
|
||||
if (index < m_List.Length)
|
||||
{
|
||||
@@ -252,7 +252,7 @@ namespace Unity.Netcode
|
||||
case NetworkListEvent<T>.EventType.Remove:
|
||||
{
|
||||
var value = new T();
|
||||
NetworkVariableSerialization<T>.Read(reader, ref value);
|
||||
NetworkVariableSerialization<T>.Serializer.Read(reader, ref value);
|
||||
int index = m_List.IndexOf(value);
|
||||
if (index == -1)
|
||||
{
|
||||
@@ -315,7 +315,7 @@ namespace Unity.Netcode
|
||||
{
|
||||
ByteUnpacker.ReadValueBitPacked(reader, out int index);
|
||||
var value = new T();
|
||||
NetworkVariableSerialization<T>.Read(reader, ref value);
|
||||
NetworkVariableSerialization<T>.Serializer.Read(reader, ref value);
|
||||
if (index >= m_List.Length)
|
||||
{
|
||||
throw new Exception("Shouldn't be here, index is higher than list length");
|
||||
|
||||
Reference in New Issue
Block a user