From 075420b4e19d62892136c19ebfd09143009dfe85 Mon Sep 17 00:00:00 2001 From: Noel Stephens Date: Tue, 2 Jun 2026 17:32:55 -0500 Subject: [PATCH 1/4] update Replacing DEVELOPMENT_BUILD || UNITY_EDITOR with DEBUG. Replacing niche DEVELOPMENT_BUILD uses with DEBUG. --- .../Connection/NetworkConnectionManager.cs | 22 ++++----- .../Runtime/Core/NetworkBehaviour.cs | 12 ++--- .../Runtime/Core/NetworkBehaviourUpdater.cs | 6 +-- .../Runtime/Core/NetworkManager.cs | 6 +-- .../Runtime/Messaging/CustomMessageManager.cs | 2 +- .../Runtime/Messaging/Messages/RpcMessages.cs | 2 +- .../Messaging/NetworkMessageManager.cs | 2 +- .../Messaging/RpcTargets/BaseRpcTarget.cs | 2 +- .../RpcTargets/LocalSendRpcTarget.cs | 2 +- .../RpcTargets/ProxyRpcTargetGroup.cs | 2 +- .../Messaging/RpcTargets/ServerRpcTarget.cs | 2 +- .../Runtime/Serialization/BitReader.cs | 12 ++--- .../Runtime/Serialization/BitWriter.cs | 12 ++--- .../Runtime/Serialization/FastBufferReader.cs | 34 ++++++------- .../Runtime/Serialization/FastBufferWriter.cs | 36 +++++++------- .../Runtime/Timing/NetworkTickSystem.cs | 6 +-- .../Runtime/Timing/NetworkTimeSystem.cs | 6 +-- .../Runtime/Transports/UTP/UnityTransport.cs | 2 +- .../Resources/PerformanceTestRunInfo.json | 1 + .../PerformanceTestRunInfo.json.meta | 7 +++ .../Resources/PerformanceTestRunSettings.json | 1 + .../PerformanceTestRunSettings.json.meta | 7 +++ .../SceneTransitioningBase1.unity | 48 ++++++++++++++++--- 23 files changed, 141 insertions(+), 91 deletions(-) create mode 100644 testproject/Assets/Resources/PerformanceTestRunInfo.json create mode 100644 testproject/Assets/Resources/PerformanceTestRunInfo.json.meta create mode 100644 testproject/Assets/Resources/PerformanceTestRunSettings.json create mode 100644 testproject/Assets/Resources/PerformanceTestRunSettings.json.meta diff --git a/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs b/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs index abd63a8254..5a8724374c 100644 --- a/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs +++ b/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs @@ -96,7 +96,7 @@ public struct ConnectionEventData /// public sealed class NetworkConnectionManager { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG private static ProfilerMarker s_TransportPollMarker = new ProfilerMarker($"{nameof(NetworkManager)}.TransportPoll"); private static ProfilerMarker s_TransportConnect = new ProfilerMarker($"{nameof(NetworkManager)}.TransportConnect"); private static ProfilerMarker s_HandleIncomingData = new ProfilerMarker($"{nameof(NetworkManager)}.{nameof(NetworkMessageManager.HandleIncomingData)}"); @@ -438,7 +438,7 @@ private ulong GetServerTransportId() internal void PollAndHandleNetworkEvents() { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG s_TransportPollMarker.Begin(); #endif NetworkEvent networkEvent; @@ -453,7 +453,7 @@ internal void PollAndHandleNetworkEvents() // Only do another iteration if: there are no more messages AND (there is no limit to max events or we have processed less than the maximum) } while (NetworkManager.IsListening && networkEvent != NetworkEvent.Nothing); -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG s_TransportPollMarker.End(); #endif } @@ -501,7 +501,7 @@ internal void HandleNetworkEvent(NetworkEvent networkEvent, ulong transportClien /// internal void ConnectEventHandler(ulong transportId) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG s_TransportConnect.Begin(); #endif // Assumptions: @@ -522,7 +522,7 @@ internal void ConnectEventHandler(ulong transportId) { NetworkLog.LogError($"[TransportApproval][Server] TransportId {transportId} is already connected to this server!"); } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG s_TransportConnect.End(); #endif return; @@ -539,7 +539,7 @@ internal void ConnectEventHandler(ulong transportId) { NetworkLog.LogError("[TransportApproval][Client] Client received a transport connection event after already connecting!"); } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG s_TransportConnect.End(); #endif return; @@ -577,7 +577,7 @@ internal void ConnectEventHandler(ulong transportId) StartClientApprovalCoroutine(clientId); } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG s_TransportConnect.End(); #endif } @@ -587,7 +587,7 @@ internal void ConnectEventHandler(ulong transportId) /// internal void DataEventHandler(ulong transportClientId, ref ArraySegment payload, float receiveTime) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG s_HandleIncomingData.Begin(); #endif var (clientId, isConnectedClient) = TransportIdToClientId(transportClientId); @@ -596,7 +596,7 @@ internal void DataEventHandler(ulong transportClientId, ref ArraySegment p MessageManager.HandleIncomingData(clientId, payload, receiveTime); } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG s_HandleIncomingData.End(); #endif } @@ -639,7 +639,7 @@ internal void DisconnectEventHandler(ulong transportClientId) return; } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG s_TransportDisconnect.Begin(); #endif @@ -698,7 +698,7 @@ internal void DisconnectEventHandler(ulong transportClientId) NetworkManager.Shutdown(true); } } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG s_TransportDisconnect.End(); #endif } diff --git a/com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviour.cs b/com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviour.cs index 28ec5033b8..16b6d3be62 100644 --- a/com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviour.cs +++ b/com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviour.cs @@ -43,7 +43,7 @@ public abstract class NetworkBehaviour : MonoBehaviour internal static readonly Dictionary> __rpc_func_table = new Dictionary>(); internal static readonly Dictionary> __rpc_permission_table = new Dictionary>(); -#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) +#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) // RuntimeAccessModifiersILPP will make this `public` internal static readonly Dictionary> __rpc_name_table = new Dictionary>(); #endif @@ -145,7 +145,7 @@ internal void __endSendServerRpc(ref FastBufferWriter bufferWriter, uint rpcMeth bufferWriter.Dispose(); -#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) +#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) TrackRpcMetricsSend(ref serverRpcMessage, rpcMethodId, rpcWriteSize); #endif } @@ -269,7 +269,7 @@ internal void __endSendClientRpc(ref FastBufferWriter bufferWriter, uint rpcMeth } bufferWriter.Dispose(); -#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) +#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) if (!ValidateRpcMessageMetrics(GetType())) { return; @@ -1002,12 +1002,12 @@ internal void __registerRpc(uint hash, RpcReceiveHandler handler, string rpcMeth var rpcType = GetType(); __rpc_func_table[rpcType][hash] = handler; __rpc_permission_table[rpcType][hash] = permission; -#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) +#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) __rpc_name_table[rpcType][hash] = rpcMethodName; #endif } -#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) +#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) [MethodImpl(MethodImplOptions.AggressiveInlining)] private bool ValidateRpcMessageMetrics(Type type) { @@ -1125,7 +1125,7 @@ internal void InitializeVariables() { __rpc_func_table[GetType()] = new Dictionary(); __rpc_permission_table[GetType()] = new Dictionary(); -#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) +#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) __rpc_name_table[GetType()] = new Dictionary(); #endif __initializeRpcs(); diff --git a/com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviourUpdater.cs b/com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviourUpdater.cs index 4f12bca033..871c8afb7d 100644 --- a/com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviourUpdater.cs +++ b/com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviourUpdater.cs @@ -27,7 +27,7 @@ public class NetworkBehaviourUpdater /// private HashSet m_PendingDirtyNetworkObjects = new HashSet(); -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG private ProfilerMarker m_NetworkBehaviourUpdate = new ProfilerMarker($"{nameof(NetworkBehaviour)}.{nameof(NetworkBehaviourUpdate)}"); #endif @@ -190,7 +190,7 @@ internal void ProcessDirtyObject(NetworkObject networkObject, bool forceSend) /// Refer to the definition. internal void NetworkBehaviourUpdate(bool forceSend = false) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG m_NetworkBehaviourUpdate.Begin(); #endif try @@ -214,7 +214,7 @@ internal void NetworkBehaviourUpdate(bool forceSend = false) } finally { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG m_NetworkBehaviourUpdate.End(); #endif } diff --git a/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs b/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs index 4c7ca603db..453f10b88f 100644 --- a/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs +++ b/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs @@ -70,7 +70,7 @@ private static void ResetStaticsOnLoad() #pragma warning restore IDE1006 // restore naming rule violation check -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG private static List s_SerializedType = new List(); // This is used to control the serialized type not optimized messaging for integration test purposes internal static bool DisableNotOptimizedSerializedType; @@ -1176,7 +1176,7 @@ public int MaximumFragmentedMessageSize internal void Initialize(bool server) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (!DisableNotOptimizedSerializedType) { s_SerializedType.Clear(); @@ -1239,7 +1239,7 @@ internal void Initialize(bool server) MessageManager.Hook(new NetworkManagerHooks(this)); -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (NetworkConfig.NetworkProfilingMetrics) { MessageManager.Hook(new ProfilingHooks()); diff --git a/com.unity.netcode.gameobjects/Runtime/Messaging/CustomMessageManager.cs b/com.unity.netcode.gameobjects/Runtime/Messaging/CustomMessageManager.cs index 15e30205f8..58a1f93470 100644 --- a/com.unity.netcode.gameobjects/Runtime/Messaging/CustomMessageManager.cs +++ b/com.unity.netcode.gameobjects/Runtime/Messaging/CustomMessageManager.cs @@ -434,7 +434,7 @@ public void SendNamedMessage(string messageName, IReadOnlyList clientIds, /// Exception thrown in case validation fails private unsafe void ValidateMessageSize(FastBufferWriter messageStream, NetworkDelivery networkDelivery, bool isNamed) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG var maxNonFragmentedSize = m_NetworkManager.MessageManager.NonFragmentedMessageMaxSize - FastBufferWriter.GetWriteSize() - sizeof(NetworkBatchHeader); if (isNamed) { diff --git a/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/RpcMessages.cs b/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/RpcMessages.cs index 843d875216..b7f1320788 100644 --- a/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/RpcMessages.cs +++ b/com.unity.netcode.gameobjects/Runtime/Messaging/Messages/RpcMessages.cs @@ -71,7 +71,7 @@ public static void Handle(ref NetworkContext context, ref RpcMetadata metadata, return; } -#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) +#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) networkBehaviour.TrackRpcMetricsReceive(ref metadata, ref context, payload.Length); #endif diff --git a/com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs b/com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs index 53714455c6..343cec9961 100644 --- a/com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs +++ b/com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs @@ -849,7 +849,7 @@ internal unsafe void ProcessSendQueues() } queueItem.Writer.Seek(0); -#if UNITY_EDITOR || DEVELOPMENT_BUILD +#if DEBUG // Skipping the Verify and sneaking the write mark in because we know it's fine. queueItem.Writer.Handle->AllowedWriteMark = sizeof(NetworkBatchHeader); #endif diff --git a/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/BaseRpcTarget.cs b/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/BaseRpcTarget.cs index a1e12a5310..a1b5b5d8aa 100644 --- a/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/BaseRpcTarget.cs +++ b/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/BaseRpcTarget.cs @@ -53,7 +53,7 @@ protected void CheckLockBeforeDispose() private protected void SendMessageToClient(NetworkBehaviour behaviour, ulong clientId, ref RpcMessage message, NetworkDelivery delivery) { var size = behaviour.NetworkManager.MessageManager.SendMessage(ref message, delivery, clientId); -#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) +#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) // Send to a specific client behaviour.TrackRpcMetricsSend(clientId, ref message, size); #endif diff --git a/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/LocalSendRpcTarget.cs b/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/LocalSendRpcTarget.cs index 386af8816f..4afa621d11 100644 --- a/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/LocalSendRpcTarget.cs +++ b/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/LocalSendRpcTarget.cs @@ -46,7 +46,7 @@ internal override void Send(NetworkBehaviour behaviour, ref RpcMessage message, message.Handle(ref context); length = tempBuffer.Length; } -#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) +#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) // Local invocation sends to self behaviour.TrackRpcMetricsSend(m_NetworkManager.LocalClientId, ref message, length); #endif diff --git a/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ProxyRpcTargetGroup.cs b/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ProxyRpcTargetGroup.cs index 8dd2e744eb..40321b3742 100644 --- a/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ProxyRpcTargetGroup.cs +++ b/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ProxyRpcTargetGroup.cs @@ -24,7 +24,7 @@ internal override void Send(NetworkBehaviour behaviour, ref RpcMessage message, } var proxyMessage = new ProxyMessage { Delivery = delivery, TargetClientIds = TargetClientIds.AsArray(), WrappedMessage = message }; var size = behaviour.NetworkManager.MessageManager.SendMessage(ref proxyMessage, delivery, NetworkManager.ServerClientId); -#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) +#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) foreach (var clientId in TargetClientIds) { behaviour.TrackRpcMetricsSend(clientId, ref message, size); diff --git a/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ServerRpcTarget.cs b/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ServerRpcTarget.cs index 63380ce40c..7382b41153 100644 --- a/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ServerRpcTarget.cs +++ b/com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ServerRpcTarget.cs @@ -36,7 +36,7 @@ internal override void Send(NetworkBehaviour behaviour, ref RpcMessage message, using var tempBuffer = new FastBufferReader(message.WriteBuffer, Allocator.None); message.ReadBuffer = tempBuffer; message.Handle(ref context); -#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) +#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) // Local invocation sends to self behaviour.TrackRpcMetricsSend(m_NetworkManager.LocalClientId, ref message, tempBuffer.Length); #endif diff --git a/com.unity.netcode.gameobjects/Runtime/Serialization/BitReader.cs b/com.unity.netcode.gameobjects/Runtime/Serialization/BitReader.cs index dcb30a92dd..ab8c9bc5ce 100644 --- a/com.unity.netcode.gameobjects/Runtime/Serialization/BitReader.cs +++ b/com.unity.netcode.gameobjects/Runtime/Serialization/BitReader.cs @@ -15,7 +15,7 @@ public ref struct BitReader private readonly unsafe byte* m_BufferPointer; private readonly int m_Position; private int m_BitPosition; -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG private int m_AllowedBitwiseReadMark; #endif @@ -39,7 +39,7 @@ internal unsafe BitReader(FastBufferReader reader) m_BufferPointer = m_Reader.Handle->BufferPointer + m_Reader.Handle->Position; m_Position = m_Reader.Handle->Position; m_BitPosition = 0; -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG m_AllowedBitwiseReadMark = (m_Reader.Handle->AllowedReadMark - m_Position) * k_BitsPerByte; #endif } @@ -81,7 +81,7 @@ public unsafe bool TryBeginReadBits(uint bitCount) { return false; } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG m_AllowedBitwiseReadMark = (int)newBitPosition; #endif return true; @@ -94,7 +94,7 @@ public unsafe bool TryBeginReadBits(uint bitCount) /// Amount of bits to read public unsafe void ReadBits(out ulong value, uint bitCount) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (bitCount > 64) { throw new ArgumentOutOfRangeException(nameof(bitCount), "Cannot read more than 64 bits from a 64-bit value!"); @@ -136,7 +136,7 @@ public unsafe void ReadBits(out ulong value, uint bitCount) /// Amount of bits to read. public void ReadBits(out byte value, uint bitCount) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG int checkPos = (int)(m_BitPosition + bitCount); if (checkPos > m_AllowedBitwiseReadMark) { @@ -153,7 +153,7 @@ public void ReadBits(out byte value, uint bitCount) [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void ReadBit(out bool bit) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG int checkPos = (m_BitPosition + 1); if (checkPos > m_AllowedBitwiseReadMark) { diff --git a/com.unity.netcode.gameobjects/Runtime/Serialization/BitWriter.cs b/com.unity.netcode.gameobjects/Runtime/Serialization/BitWriter.cs index 0e3ccfb7e3..7b38bcadc9 100644 --- a/com.unity.netcode.gameobjects/Runtime/Serialization/BitWriter.cs +++ b/com.unity.netcode.gameobjects/Runtime/Serialization/BitWriter.cs @@ -15,7 +15,7 @@ public ref struct BitWriter private unsafe byte* m_BufferPointer; private readonly int m_Position; private int m_BitPosition; -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG private int m_AllowedBitwiseWriteMark; #endif private const int k_BitsPerByte = 8; @@ -37,7 +37,7 @@ internal unsafe BitWriter(FastBufferWriter writer) m_BufferPointer = writer.Handle->BufferPointer + writer.Handle->Position; m_Position = writer.Handle->Position; m_BitPosition = 0; -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG m_AllowedBitwiseWriteMark = (m_Writer.Handle->AllowedWriteMark - m_Writer.Handle->Position) * k_BitsPerByte; #endif } @@ -97,7 +97,7 @@ public unsafe bool TryBeginWriteBits(int bitCount) return false; } } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG m_AllowedBitwiseWriteMark = newBitPosition; #endif return true; @@ -110,7 +110,7 @@ public unsafe bool TryBeginWriteBits(int bitCount) /// Amount of bits to write public unsafe void WriteBits(ulong value, uint bitCount) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (bitCount > 64) { throw new ArgumentOutOfRangeException(nameof(bitCount), "Cannot write more than 64 bits from a 64-bit value!"); @@ -153,7 +153,7 @@ public unsafe void WriteBits(ulong value, uint bitCount) /// Amount of bits to write. public void WriteBits(byte value, uint bitCount) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG int checkPos = (int)(m_BitPosition + bitCount); if (checkPos > m_AllowedBitwiseWriteMark) { @@ -174,7 +174,7 @@ public void WriteBits(byte value, uint bitCount) [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void WriteBit(bool bit) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG int checkPos = (m_BitPosition + 1); if (checkPos > m_AllowedBitwiseWriteMark) { diff --git a/com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferReader.cs b/com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferReader.cs index d0dfdca7cd..d420ccd28e 100644 --- a/com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferReader.cs +++ b/com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferReader.cs @@ -20,7 +20,7 @@ internal struct ReaderHandle internal int Position; internal int Length; internal Allocator Allocator; -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG internal int AllowedReadMark; internal bool InBitwiseContext; #endif @@ -55,7 +55,7 @@ public unsafe int Length internal unsafe void CommitBitwiseReads(int amount) { Handle->Position += amount; -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG Handle->InBitwiseContext = false; #endif } @@ -83,7 +83,7 @@ internal unsafe void CommitBitwiseReads(int amount) // When we dispose, we are really only interested in disposing Allocator.Persistent and Allocator.TempJob // as disposing Allocator.Temp and Allocator.None would do nothing. Therefore, make sure we dispose the readerHandle with the right Allocator label readerHandle->Allocator = copyAllocator == Allocator.None ? internalAllocator : copyAllocator; -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG readerHandle->AllowedReadMark = 0; readerHandle->InBitwiseContext = false; #endif @@ -321,7 +321,7 @@ public unsafe void Seek(int where) [MethodImpl(MethodImplOptions.AggressiveInlining)] internal unsafe void MarkBytesRead(int amount) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -343,7 +343,7 @@ internal unsafe void MarkBytesRead(int amount) /// A BitReader public unsafe BitReader EnterBitwiseContext() { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG Handle->InBitwiseContext = true; #endif return new BitReader(this); @@ -366,7 +366,7 @@ public unsafe BitReader EnterBitwiseContext() [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe bool TryBeginRead(int bytes) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -377,7 +377,7 @@ public unsafe bool TryBeginRead(int bytes) { return false; } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG Handle->AllowedReadMark = Handle->Position + bytes; #endif return true; @@ -401,7 +401,7 @@ public unsafe bool TryBeginRead(int bytes) [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe bool TryBeginReadValue(in T value) where T : unmanaged { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -413,7 +413,7 @@ public unsafe bool TryBeginReadValue(in T value) where T : unmanaged { return false; } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG Handle->AllowedReadMark = Handle->Position + len; #endif return true; @@ -429,7 +429,7 @@ public unsafe bool TryBeginReadValue(in T value) where T : unmanaged [MethodImpl(MethodImplOptions.AggressiveInlining)] internal unsafe bool TryBeginReadInternal(int bytes) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -440,7 +440,7 @@ internal unsafe bool TryBeginReadInternal(int bytes) { return false; } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->Position + bytes > Handle->AllowedReadMark) { Handle->AllowedReadMark = Handle->Position + bytes; @@ -602,7 +602,7 @@ public unsafe void ReadValue(out string s, bool oneByteChars = false) /// Whether or not to use one byte per character. This will only allow ASCII public unsafe void ReadValueSafe(out string s, bool oneByteChars = false) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -679,7 +679,7 @@ private void ReadLength(out int length) [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void ReadPartialValue(out T value, int bytesToRead, int offsetBytes = 0) where T : unmanaged { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -707,7 +707,7 @@ public unsafe void ReadPartialValue(out T value, int bytesToRead, int offsetB [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void ReadByte(out byte value) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -731,7 +731,7 @@ public unsafe void ReadByte(out byte value) [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void ReadByteSafe(out byte value) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -755,7 +755,7 @@ public unsafe void ReadByteSafe(out byte value) [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void ReadBytes(byte* value, int size, int offset = 0) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -782,7 +782,7 @@ public unsafe void ReadBytes(byte* value, int size, int offset = 0) [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void ReadBytesSafe(byte* value, int size, int offset = 0) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( diff --git a/com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferWriter.cs b/com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferWriter.cs index ca39ea8c62..343822fe32 100644 --- a/com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferWriter.cs +++ b/com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferWriter.cs @@ -23,7 +23,7 @@ internal struct WriterHandle internal int MaxCapacity; internal Allocator Allocator; internal bool BufferGrew; -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG internal int AllowedWriteMark; internal bool InBitwiseContext; #endif @@ -79,7 +79,7 @@ public unsafe int Length internal unsafe void CommitBitwiseWrites(int amount) { Handle->Position += amount; -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG Handle->InBitwiseContext = false; #endif } @@ -97,7 +97,7 @@ public unsafe FastBufferWriter(int size, Allocator allocator, int maxSize = -1) // If the buffer grows, a new buffer will be allocated and the handle pointer pointed at the new location... // The original buffer won't be deallocated until the writer is destroyed since it's part of the handle allocation. Handle = (WriterHandle*)UnsafeUtility.Malloc(sizeof(WriterHandle) + size, UnsafeUtility.AlignOf(), allocator); -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG UnsafeUtility.MemSet(Handle, 0, sizeof(WriterHandle) + size); #endif Handle->BufferPointer = (byte*)(Handle + 1); @@ -107,7 +107,7 @@ public unsafe FastBufferWriter(int size, Allocator allocator, int maxSize = -1) Handle->Allocator = allocator; Handle->MaxCapacity = maxSize < size ? size : maxSize; Handle->BufferGrew = false; -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG Handle->AllowedWriteMark = 0; Handle->InBitwiseContext = false; #endif @@ -185,7 +185,7 @@ public unsafe void Truncate(int where = -1) /// A BitWriter public unsafe BitWriter EnterBitwiseContext() { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG Handle->InBitwiseContext = true; #endif return new BitWriter(this); @@ -201,7 +201,7 @@ internal unsafe void Grow(int additionalSizeRequired) var newSize = Math.Min(desiredSize, Handle->MaxCapacity); byte* newBuffer = (byte*)UnsafeUtility.Malloc(newSize, UnsafeUtility.AlignOf(), Handle->Allocator); -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG UnsafeUtility.MemSet(newBuffer, 0, newSize); #endif UnsafeUtility.MemCpy(newBuffer, Handle->BufferPointer, Length); @@ -232,7 +232,7 @@ internal unsafe void Grow(int additionalSizeRequired) [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe bool TryBeginWrite(int bytes) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -255,7 +255,7 @@ public unsafe bool TryBeginWrite(int bytes) return false; } } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG Handle->AllowedWriteMark = Handle->Position + bytes; #endif return true; @@ -280,7 +280,7 @@ public unsafe bool TryBeginWrite(int bytes) [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe bool TryBeginWriteValue(in T value) where T : unmanaged { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -304,7 +304,7 @@ public unsafe bool TryBeginWriteValue(in T value) where T : unmanaged return false; } } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG Handle->AllowedWriteMark = Handle->Position + len; #endif return true; @@ -320,7 +320,7 @@ public unsafe bool TryBeginWriteValue(in T value) where T : unmanaged [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe bool TryBeginWriteInternal(int bytes) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -343,7 +343,7 @@ public unsafe bool TryBeginWriteInternal(int bytes) return false; } } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->Position + bytes > Handle->AllowedWriteMark) { Handle->AllowedWriteMark = Handle->Position + bytes; @@ -523,7 +523,7 @@ public unsafe void WriteValue(string s, bool oneByteChars = false) /// Whether or not to use one byte per character. This will only allow ASCII public unsafe void WriteValueSafe(string s, bool oneByteChars = false) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -618,7 +618,7 @@ public static unsafe int GetWriteSize(NativeList array, int count = -1, in [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void WritePartialValue(T value, int bytesToWrite, int offsetBytes = 0) where T : unmanaged { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -644,7 +644,7 @@ public unsafe void WritePartialValue(T value, int bytesToWrite, int offsetByt [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void WriteByte(byte value) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -668,7 +668,7 @@ public unsafe void WriteByte(byte value) [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void WriteByteSafe(byte value) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -692,7 +692,7 @@ public unsafe void WriteByteSafe(byte value) [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void WriteBytes(byte* value, int size, int offset = 0) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( @@ -719,7 +719,7 @@ public unsafe void WriteBytes(byte* value, int size, int offset = 0) [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void WriteBytesSafe(byte* value, int size, int offset = 0) { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG if (Handle->InBitwiseContext) { throw new InvalidOperationException( diff --git a/com.unity.netcode.gameobjects/Runtime/Timing/NetworkTickSystem.cs b/com.unity.netcode.gameobjects/Runtime/Timing/NetworkTickSystem.cs index be03c1b478..821f727ed3 100644 --- a/com.unity.netcode.gameobjects/Runtime/Timing/NetworkTickSystem.cs +++ b/com.unity.netcode.gameobjects/Runtime/Timing/NetworkTickSystem.cs @@ -10,7 +10,7 @@ namespace Unity.Netcode [Serializable] public class NetworkTickSystem { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG private static ProfilerMarker s_Tick = new ProfilerMarker($"{nameof(NetworkTickSystem)}.Tick"); #endif @@ -97,11 +97,11 @@ public void UpdateTick(double localTimeSec, double serverTimeSec) LocalTime = new NetworkTime(TickRate, i); ServerTime = new NetworkTime(TickRate, i - localToServerDifference); -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG s_Tick.Begin(); #endif Tick?.Invoke(); -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG s_Tick.End(); #endif } diff --git a/com.unity.netcode.gameobjects/Runtime/Timing/NetworkTimeSystem.cs b/com.unity.netcode.gameobjects/Runtime/Timing/NetworkTimeSystem.cs index 16f4173f24..a967052a16 100644 --- a/com.unity.netcode.gameobjects/Runtime/Timing/NetworkTimeSystem.cs +++ b/com.unity.netcode.gameobjects/Runtime/Timing/NetworkTimeSystem.cs @@ -34,7 +34,7 @@ public class NetworkTimeSystem /// private const double k_DefaultAdjustmentRatio = 0.01d; -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG private static ProfilerMarker s_SyncTime = new ProfilerMarker($"{nameof(NetworkManager)}.SyncTime"); #endif private double m_PreviousTimeSec; @@ -182,7 +182,7 @@ internal void UpdateTime() /// private void OnTickSyncTime() { -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG s_SyncTime.Begin(); #endif @@ -196,7 +196,7 @@ private void OnTickSyncTime() m_ConnectionManager.SendMessage(ref message, m_NetworkDelivery, m_ConnectionManager.ConnectedClientIds); } -#if DEVELOPMENT_BUILD || UNITY_EDITOR +#if DEBUG s_SyncTime.End(); #endif } diff --git a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs index fda0629b92..cac615f394 100644 --- a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs +++ b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs @@ -1,7 +1,7 @@ // NetSim Implementation compilation boilerplate // All references to UNITY_MP_TOOLS_NETSIM_IMPLEMENTATION_ENABLED should be defined in the same way, // as any discrepancies are likely to result in build failures -#if UNITY_EDITOR || (DEVELOPMENT_BUILD && !UNITY_MP_TOOLS_NETSIM_DISABLED_IN_DEVELOP) || (!DEVELOPMENT_BUILD && UNITY_MP_TOOLS_NETSIM_ENABLED_IN_RELEASE) +#if UNITY_EDITOR || (DEBUG && !UNITY_MP_TOOLS_NETSIM_DISABLED_IN_DEVELOP) || (!DEBUG && UNITY_MP_TOOLS_NETSIM_ENABLED_IN_RELEASE) #define UNITY_MP_TOOLS_NETSIM_IMPLEMENTATION_ENABLED #endif diff --git a/testproject/Assets/Resources/PerformanceTestRunInfo.json b/testproject/Assets/Resources/PerformanceTestRunInfo.json new file mode 100644 index 0000000000..95fc879bf4 --- /dev/null +++ b/testproject/Assets/Resources/PerformanceTestRunInfo.json @@ -0,0 +1 @@ +{"TestSuite":"","Date":0,"Player":{"Development":false,"ScreenWidth":0,"ScreenHeight":0,"ScreenRefreshRate":0,"Fullscreen":false,"Vsync":0,"AntiAliasing":0,"Batchmode":false,"RenderThreadingMode":"Split","MtRendering":false,"GraphicsJobs":false,"GpuSkinning":true,"Platform":"","ColorSpace":"","AnisotropicFiltering":"","BlendWeights":"","GraphicsApi":"","ScriptingBackend":"Mono2x","AndroidTargetSdkVersion":"AndroidApiLevelAuto","AndroidBuildSystem":"Gradle","BuildTarget":"StandaloneWindows64","StereoRenderingPath":"MultiPass"},"Hardware":{"OperatingSystem":"","DeviceModel":"","DeviceName":"","ProcessorType":"","ProcessorCount":0,"GraphicsDeviceName":"","SystemMemorySizeMB":0},"Editor":{"Version":"6000.4.0f1","Branch":"6000.4/staging","Changeset":"8cf496087c8f","Date":1773430047},"Dependencies":["com.unity.addressables@2.9.1","com.unity.ai.navigation@2.0.11","com.unity.collab-proxy@2.11.4","com.unity.ide.rider@3.0.39","com.unity.ide.visualstudio@2.0.27","com.unity.mathematics@1.3.3","com.unity.multiplayer.tools@2.2.8","com.unity.netcode.gameobjects@2.13.0","com.unity.package-validation-suite@0.49.0-preview","com.unity.services.authentication@3.6.0","com.unity.services.multiplayer@2.1.3","com.unity.test-framework@1.6.0","com.unity.test-framework.performance@3.2.0","com.unity.timeline@1.8.11","com.unity.ugui@2.0.0","com.unity.modules.accessibility@1.0.0","com.unity.modules.adaptiveperformance@1.0.0","com.unity.modules.ai@1.0.0","com.unity.modules.androidjni@1.0.0","com.unity.modules.animation@1.0.0","com.unity.modules.assetbundle@1.0.0","com.unity.modules.audio@1.0.0","com.unity.modules.cloth@1.0.0","com.unity.modules.director@1.0.0","com.unity.modules.imageconversion@1.0.0","com.unity.modules.imgui@1.0.0","com.unity.modules.jsonserialize@1.0.0","com.unity.modules.particlesystem@1.0.0","com.unity.modules.physics@1.0.0","com.unity.modules.physics2d@1.0.0","com.unity.modules.screencapture@1.0.0","com.unity.modules.terrain@1.0.0","com.unity.modules.terrainphysics@1.0.0","com.unity.modules.tilemap@1.0.0","com.unity.modules.ui@1.0.0","com.unity.modules.uielements@1.0.0","com.unity.modules.umbra@1.0.0","com.unity.modules.unityanalytics@1.0.0","com.unity.modules.unitywebrequest@1.0.0","com.unity.modules.unitywebrequestassetbundle@1.0.0","com.unity.modules.unitywebrequestaudio@1.0.0","com.unity.modules.unitywebrequesttexture@1.0.0","com.unity.modules.unitywebrequestwww@1.0.0","com.unity.modules.vectorgraphics@1.0.0","com.unity.modules.vehicles@1.0.0","com.unity.modules.video@1.0.0","com.unity.modules.vr@1.0.0","com.unity.modules.wind@1.0.0","com.unity.modules.xr@1.0.0","com.unity.modules.subsystems@1.0.0","com.unity.modules.hierarchycore@1.0.0","com.unity.ext.nunit@2.0.5","com.unity.transport@2.6.0","com.unity.collections@6.4.0","com.unity.services.qos@1.4.1","com.unity.services.core@1.16.0","com.unity.services.wire@1.4.2","com.unity.services.deployment@1.7.2","com.unity.nuget.newtonsoft-json@3.2.2","com.unity.nuget.mono-cecil@1.11.6","com.unity.burst@1.8.28","com.unity.profiling.core@1.0.3","com.unity.scriptablebuildpipeline@2.6.1","com.unity.services.deployment.api@1.1.3"],"Results":[]} \ No newline at end of file diff --git a/testproject/Assets/Resources/PerformanceTestRunInfo.json.meta b/testproject/Assets/Resources/PerformanceTestRunInfo.json.meta new file mode 100644 index 0000000000..635171a842 --- /dev/null +++ b/testproject/Assets/Resources/PerformanceTestRunInfo.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6617ac473bbf1fb469a1f1b86938ae25 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/testproject/Assets/Resources/PerformanceTestRunSettings.json b/testproject/Assets/Resources/PerformanceTestRunSettings.json new file mode 100644 index 0000000000..49438ae14b --- /dev/null +++ b/testproject/Assets/Resources/PerformanceTestRunSettings.json @@ -0,0 +1 @@ +{"MeasurementCount":-1} \ No newline at end of file diff --git a/testproject/Assets/Resources/PerformanceTestRunSettings.json.meta b/testproject/Assets/Resources/PerformanceTestRunSettings.json.meta new file mode 100644 index 0000000000..a7396621fd --- /dev/null +++ b/testproject/Assets/Resources/PerformanceTestRunSettings.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 81506d0e8855f1e46ba800cadea6a371 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/testproject/Assets/Tests/Manual/SceneTransitioningAdditive/SceneTransitioningBase1.unity b/testproject/Assets/Tests/Manual/SceneTransitioningAdditive/SceneTransitioningBase1.unity index bab567858b..e1dfeb1a4d 100644 --- a/testproject/Assets/Tests/Manual/SceneTransitioningAdditive/SceneTransitioningBase1.unity +++ b/testproject/Assets/Tests/Manual/SceneTransitioningAdditive/SceneTransitioningBase1.unity @@ -246,6 +246,7 @@ MonoBehaviour: Ownership: 1 AlwaysReplicateAsRoot: 0 SynchronizeTransform: 1 + k__BackingField: 0 ActiveSceneSynchronization: 0 SceneMigrationSynchronization: 1 SpawnWithObservers: 1 @@ -278,14 +279,14 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 37242881} m_Enabled: 1 - serializedVersion: 11 + serializedVersion: 13 m_Type: 1 m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} m_Intensity: 1 m_Range: 10 m_SpotAngle: 30 m_InnerSpotAngle: 21.80208 - m_CookieSize: 10 + m_CookieSize2D: {x: 10, y: 10} m_Shadows: m_Type: 2 m_Resolution: -1 @@ -330,7 +331,7 @@ Light: m_UseBoundingSphereOverride: 0 m_UseViewFrustumForShadowCasterCull: 1 m_ForceVisible: 0 - m_ShadowRadius: 0 + m_ShapeRadius: 0 m_ShadowAngle: 0 m_LightUnit: 1 m_LuxAtDistance: 1 @@ -646,6 +647,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -667,9 +670,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &57392473 MeshFilter: @@ -979,6 +984,7 @@ Canvas: m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 m_VertexColorAlwaysGammaSpace: 0 + m_UseReflectionProbes: 0 m_AdditionalShaderChannelsFlag: 0 m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 @@ -1157,6 +1163,7 @@ Canvas: m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 m_VertexColorAlwaysGammaSpace: 0 + m_UseReflectionProbes: 0 m_AdditionalShaderChannelsFlag: 0 m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 @@ -1408,6 +1415,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -1429,9 +1438,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &336568648 MeshFilter: @@ -2549,7 +2560,7 @@ LightingSettings: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: - serializedVersion: 9 + serializedVersion: 10 m_EnableBakedLightmaps: 1 m_EnableRealtimeLightmaps: 0 m_RealtimeEnvironmentLighting: 1 @@ -2564,6 +2575,12 @@ LightingSettings: m_BakeResolution: 40 m_Padding: 2 m_LightmapCompression: 3 + m_LightmapPackingMode: 1 + m_LightmapPackingMethod: 0 + m_XAtlasPackingAttempts: 16384 + m_XAtlasBruteForce: 0 + m_XAtlasBlockAlign: 0 + m_XAtlasRepackUnderutilizedLightmaps: 1 m_AO: 0 m_AOMaxDistance: 1 m_CompAOExponent: 1 @@ -2876,11 +2893,12 @@ MonoBehaviour: NetworkIdRecycleDelay: 120 RpcHashSize: 0 LoadSceneTimeOut: 120 - SpawnTimeout: 1 + SpawnTimeout: 10 EnableNetworkLogs: 1 NetworkTopology: 0 UseCMBService: 0 AutoSpawnPlayerPrefabClientSide: 1 + NetworkMessageMetrics: 1 NetworkProfilingMetrics: 1 OldPrefabList: - Override: 0 @@ -2934,7 +2952,7 @@ MonoBehaviour: SourceHashToOverride: 0 OverridingTargetPrefab: {fileID: 0} RunInBackground: 1 - LogLevel: 1 + LogLevel: 0 --- !u!4 &1024114720 Transform: m_ObjectHideFlags: 0 @@ -3000,7 +3018,9 @@ MonoBehaviour: ConnectionData: Address: 127.0.0.1 Port: 7777 - ServerListenAddress: + WebSocketPath: / + ServerListenAddress: 127.0.0.1 + ClientBindPort: 0 DebugSimulator: PacketDelayMS: 0 PacketJitterMS: 0 @@ -3088,6 +3108,7 @@ MonoBehaviour: Ownership: 1 AlwaysReplicateAsRoot: 0 SynchronizeTransform: 1 + k__BackingField: 0 ActiveSceneSynchronization: 0 SceneMigrationSynchronization: 1 SpawnWithObservers: 1 @@ -3399,6 +3420,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -3420,9 +3443,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1336081254 MeshFilter: @@ -5318,6 +5343,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -5339,9 +5366,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1857685346 MeshFilter: @@ -5765,6 +5794,8 @@ MeshRenderer: m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -5786,9 +5817,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &2028091271 MeshFilter: @@ -6134,6 +6167,7 @@ MonoBehaviour: Ownership: 1 AlwaysReplicateAsRoot: 0 SynchronizeTransform: 1 + k__BackingField: 0 ActiveSceneSynchronization: 0 SceneMigrationSynchronization: 1 SpawnWithObservers: 1 From 52f0eca42805cd19cd92eae5a5848f8ad09389ca Mon Sep 17 00:00:00 2001 From: Noel Stephens Date: Wed, 3 Jun 2026 09:14:59 -0500 Subject: [PATCH 2/4] update Removing extra files that didn't need to be included in this PR. --- testproject/Assets/Resources/PerformanceTestRunInfo.json | 1 - .../Assets/Resources/PerformanceTestRunInfo.json.meta | 7 ------- .../Assets/Resources/PerformanceTestRunSettings.json | 1 - .../Assets/Resources/PerformanceTestRunSettings.json.meta | 7 ------- 4 files changed, 16 deletions(-) delete mode 100644 testproject/Assets/Resources/PerformanceTestRunInfo.json delete mode 100644 testproject/Assets/Resources/PerformanceTestRunInfo.json.meta delete mode 100644 testproject/Assets/Resources/PerformanceTestRunSettings.json delete mode 100644 testproject/Assets/Resources/PerformanceTestRunSettings.json.meta diff --git a/testproject/Assets/Resources/PerformanceTestRunInfo.json b/testproject/Assets/Resources/PerformanceTestRunInfo.json deleted file mode 100644 index 95fc879bf4..0000000000 --- a/testproject/Assets/Resources/PerformanceTestRunInfo.json +++ /dev/null @@ -1 +0,0 @@ -{"TestSuite":"","Date":0,"Player":{"Development":false,"ScreenWidth":0,"ScreenHeight":0,"ScreenRefreshRate":0,"Fullscreen":false,"Vsync":0,"AntiAliasing":0,"Batchmode":false,"RenderThreadingMode":"Split","MtRendering":false,"GraphicsJobs":false,"GpuSkinning":true,"Platform":"","ColorSpace":"","AnisotropicFiltering":"","BlendWeights":"","GraphicsApi":"","ScriptingBackend":"Mono2x","AndroidTargetSdkVersion":"AndroidApiLevelAuto","AndroidBuildSystem":"Gradle","BuildTarget":"StandaloneWindows64","StereoRenderingPath":"MultiPass"},"Hardware":{"OperatingSystem":"","DeviceModel":"","DeviceName":"","ProcessorType":"","ProcessorCount":0,"GraphicsDeviceName":"","SystemMemorySizeMB":0},"Editor":{"Version":"6000.4.0f1","Branch":"6000.4/staging","Changeset":"8cf496087c8f","Date":1773430047},"Dependencies":["com.unity.addressables@2.9.1","com.unity.ai.navigation@2.0.11","com.unity.collab-proxy@2.11.4","com.unity.ide.rider@3.0.39","com.unity.ide.visualstudio@2.0.27","com.unity.mathematics@1.3.3","com.unity.multiplayer.tools@2.2.8","com.unity.netcode.gameobjects@2.13.0","com.unity.package-validation-suite@0.49.0-preview","com.unity.services.authentication@3.6.0","com.unity.services.multiplayer@2.1.3","com.unity.test-framework@1.6.0","com.unity.test-framework.performance@3.2.0","com.unity.timeline@1.8.11","com.unity.ugui@2.0.0","com.unity.modules.accessibility@1.0.0","com.unity.modules.adaptiveperformance@1.0.0","com.unity.modules.ai@1.0.0","com.unity.modules.androidjni@1.0.0","com.unity.modules.animation@1.0.0","com.unity.modules.assetbundle@1.0.0","com.unity.modules.audio@1.0.0","com.unity.modules.cloth@1.0.0","com.unity.modules.director@1.0.0","com.unity.modules.imageconversion@1.0.0","com.unity.modules.imgui@1.0.0","com.unity.modules.jsonserialize@1.0.0","com.unity.modules.particlesystem@1.0.0","com.unity.modules.physics@1.0.0","com.unity.modules.physics2d@1.0.0","com.unity.modules.screencapture@1.0.0","com.unity.modules.terrain@1.0.0","com.unity.modules.terrainphysics@1.0.0","com.unity.modules.tilemap@1.0.0","com.unity.modules.ui@1.0.0","com.unity.modules.uielements@1.0.0","com.unity.modules.umbra@1.0.0","com.unity.modules.unityanalytics@1.0.0","com.unity.modules.unitywebrequest@1.0.0","com.unity.modules.unitywebrequestassetbundle@1.0.0","com.unity.modules.unitywebrequestaudio@1.0.0","com.unity.modules.unitywebrequesttexture@1.0.0","com.unity.modules.unitywebrequestwww@1.0.0","com.unity.modules.vectorgraphics@1.0.0","com.unity.modules.vehicles@1.0.0","com.unity.modules.video@1.0.0","com.unity.modules.vr@1.0.0","com.unity.modules.wind@1.0.0","com.unity.modules.xr@1.0.0","com.unity.modules.subsystems@1.0.0","com.unity.modules.hierarchycore@1.0.0","com.unity.ext.nunit@2.0.5","com.unity.transport@2.6.0","com.unity.collections@6.4.0","com.unity.services.qos@1.4.1","com.unity.services.core@1.16.0","com.unity.services.wire@1.4.2","com.unity.services.deployment@1.7.2","com.unity.nuget.newtonsoft-json@3.2.2","com.unity.nuget.mono-cecil@1.11.6","com.unity.burst@1.8.28","com.unity.profiling.core@1.0.3","com.unity.scriptablebuildpipeline@2.6.1","com.unity.services.deployment.api@1.1.3"],"Results":[]} \ No newline at end of file diff --git a/testproject/Assets/Resources/PerformanceTestRunInfo.json.meta b/testproject/Assets/Resources/PerformanceTestRunInfo.json.meta deleted file mode 100644 index 635171a842..0000000000 --- a/testproject/Assets/Resources/PerformanceTestRunInfo.json.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 6617ac473bbf1fb469a1f1b86938ae25 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/testproject/Assets/Resources/PerformanceTestRunSettings.json b/testproject/Assets/Resources/PerformanceTestRunSettings.json deleted file mode 100644 index 49438ae14b..0000000000 --- a/testproject/Assets/Resources/PerformanceTestRunSettings.json +++ /dev/null @@ -1 +0,0 @@ -{"MeasurementCount":-1} \ No newline at end of file diff --git a/testproject/Assets/Resources/PerformanceTestRunSettings.json.meta b/testproject/Assets/Resources/PerformanceTestRunSettings.json.meta deleted file mode 100644 index a7396621fd..0000000000 --- a/testproject/Assets/Resources/PerformanceTestRunSettings.json.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 81506d0e8855f1e46ba800cadea6a371 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: From 8a264ca218f4ad0806dafa18e7cf3e930bec99fd Mon Sep 17 00:00:00 2001 From: Noel Stephens Date: Wed, 3 Jun 2026 09:36:38 -0500 Subject: [PATCH 3/4] update Adding changelog entry --- com.unity.netcode.gameobjects/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.netcode.gameobjects/CHANGELOG.md b/com.unity.netcode.gameobjects/CHANGELOG.md index 0a4aa4fde3..3493b13666 100644 --- a/com.unity.netcode.gameobjects/CHANGELOG.md +++ b/com.unity.netcode.gameobjects/CHANGELOG.md @@ -14,6 +14,7 @@ Additional documentation and release notes are available at [Multiplayer Documen ### Changed +- Changed replaced define usages of `DEVELOPMENT_BUILD || UNITY_EDITOR` and a few niche uses of `DEVELOPMENT_BUILD` with `DEBUG`. (#4006) ### Deprecated From 54f790978377f1708a3685b94f3ee0e6c0d8755f Mon Sep 17 00:00:00 2001 From: Noel Stephens Date: Wed, 3 Jun 2026 09:54:48 -0500 Subject: [PATCH 4/4] update Missed the codegen assembly. --- .../Editor/CodeGen/RuntimeAccessModifiersILPP.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.netcode.gameobjects/Editor/CodeGen/RuntimeAccessModifiersILPP.cs b/com.unity.netcode.gameobjects/Editor/CodeGen/RuntimeAccessModifiersILPP.cs index ffea9115b7..18c73ed737 100644 --- a/com.unity.netcode.gameobjects/Editor/CodeGen/RuntimeAccessModifiersILPP.cs +++ b/com.unity.netcode.gameobjects/Editor/CodeGen/RuntimeAccessModifiersILPP.cs @@ -159,7 +159,7 @@ private void ProcessNetworkBehaviour(TypeDefinition typeDefinition) { fieldDefinition.IsFamilyOrAssembly = true; } -#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) +#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE) if (fieldDefinition.Name == nameof(NetworkBehaviour.__rpc_name_table)) { fieldDefinition.IsFamilyOrAssembly = true;