Skip to content

Commit 075420b

Browse files
update
Replacing DEVELOPMENT_BUILD || UNITY_EDITOR with DEBUG. Replacing niche DEVELOPMENT_BUILD uses with DEBUG.
1 parent 7fd6ab9 commit 075420b

23 files changed

Lines changed: 141 additions & 91 deletions

com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public struct ConnectionEventData
9696
/// </summary>
9797
public sealed class NetworkConnectionManager
9898
{
99-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
99+
#if DEBUG
100100
private static ProfilerMarker s_TransportPollMarker = new ProfilerMarker($"{nameof(NetworkManager)}.TransportPoll");
101101
private static ProfilerMarker s_TransportConnect = new ProfilerMarker($"{nameof(NetworkManager)}.TransportConnect");
102102
private static ProfilerMarker s_HandleIncomingData = new ProfilerMarker($"{nameof(NetworkManager)}.{nameof(NetworkMessageManager.HandleIncomingData)}");
@@ -438,7 +438,7 @@ private ulong GetServerTransportId()
438438

439439
internal void PollAndHandleNetworkEvents()
440440
{
441-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
441+
#if DEBUG
442442
s_TransportPollMarker.Begin();
443443
#endif
444444
NetworkEvent networkEvent;
@@ -453,7 +453,7 @@ internal void PollAndHandleNetworkEvents()
453453
// 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)
454454
} while (NetworkManager.IsListening && networkEvent != NetworkEvent.Nothing);
455455

456-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
456+
#if DEBUG
457457
s_TransportPollMarker.End();
458458
#endif
459459
}
@@ -501,7 +501,7 @@ internal void HandleNetworkEvent(NetworkEvent networkEvent, ulong transportClien
501501
/// </summary>
502502
internal void ConnectEventHandler(ulong transportId)
503503
{
504-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
504+
#if DEBUG
505505
s_TransportConnect.Begin();
506506
#endif
507507
// Assumptions:
@@ -522,7 +522,7 @@ internal void ConnectEventHandler(ulong transportId)
522522
{
523523
NetworkLog.LogError($"[TransportApproval][Server] TransportId {transportId} is already connected to this server!");
524524
}
525-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
525+
#if DEBUG
526526
s_TransportConnect.End();
527527
#endif
528528
return;
@@ -539,7 +539,7 @@ internal void ConnectEventHandler(ulong transportId)
539539
{
540540
NetworkLog.LogError("[TransportApproval][Client] Client received a transport connection event after already connecting!");
541541
}
542-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
542+
#if DEBUG
543543
s_TransportConnect.End();
544544
#endif
545545
return;
@@ -577,7 +577,7 @@ internal void ConnectEventHandler(ulong transportId)
577577
StartClientApprovalCoroutine(clientId);
578578
}
579579

580-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
580+
#if DEBUG
581581
s_TransportConnect.End();
582582
#endif
583583
}
@@ -587,7 +587,7 @@ internal void ConnectEventHandler(ulong transportId)
587587
/// </summary>
588588
internal void DataEventHandler(ulong transportClientId, ref ArraySegment<byte> payload, float receiveTime)
589589
{
590-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
590+
#if DEBUG
591591
s_HandleIncomingData.Begin();
592592
#endif
593593
var (clientId, isConnectedClient) = TransportIdToClientId(transportClientId);
@@ -596,7 +596,7 @@ internal void DataEventHandler(ulong transportClientId, ref ArraySegment<byte> p
596596
MessageManager.HandleIncomingData(clientId, payload, receiveTime);
597597
}
598598

599-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
599+
#if DEBUG
600600
s_HandleIncomingData.End();
601601
#endif
602602
}
@@ -639,7 +639,7 @@ internal void DisconnectEventHandler(ulong transportClientId)
639639
return;
640640
}
641641

642-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
642+
#if DEBUG
643643
s_TransportDisconnect.Begin();
644644
#endif
645645

@@ -698,7 +698,7 @@ internal void DisconnectEventHandler(ulong transportClientId)
698698
NetworkManager.Shutdown(true);
699699
}
700700
}
701-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
701+
#if DEBUG
702702
s_TransportDisconnect.End();
703703
#endif
704704
}

com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviour.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public abstract class NetworkBehaviour : MonoBehaviour
4343
internal static readonly Dictionary<Type, Dictionary<uint, RpcReceiveHandler>> __rpc_func_table = new Dictionary<Type, Dictionary<uint, RpcReceiveHandler>>();
4444
internal static readonly Dictionary<Type, Dictionary<uint, RpcInvokePermission>> __rpc_permission_table = new Dictionary<Type, Dictionary<uint, RpcInvokePermission>>();
4545

46-
#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
46+
#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
4747
// RuntimeAccessModifiersILPP will make this `public`
4848
internal static readonly Dictionary<Type, Dictionary<uint, string>> __rpc_name_table = new Dictionary<Type, Dictionary<uint, string>>();
4949
#endif
@@ -145,7 +145,7 @@ internal void __endSendServerRpc(ref FastBufferWriter bufferWriter, uint rpcMeth
145145

146146
bufferWriter.Dispose();
147147

148-
#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
148+
#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
149149
TrackRpcMetricsSend(ref serverRpcMessage, rpcMethodId, rpcWriteSize);
150150
#endif
151151
}
@@ -269,7 +269,7 @@ internal void __endSendClientRpc(ref FastBufferWriter bufferWriter, uint rpcMeth
269269
}
270270

271271
bufferWriter.Dispose();
272-
#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
272+
#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
273273
if (!ValidateRpcMessageMetrics(GetType()))
274274
{
275275
return;
@@ -1002,12 +1002,12 @@ internal void __registerRpc(uint hash, RpcReceiveHandler handler, string rpcMeth
10021002
var rpcType = GetType();
10031003
__rpc_func_table[rpcType][hash] = handler;
10041004
__rpc_permission_table[rpcType][hash] = permission;
1005-
#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
1005+
#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
10061006
__rpc_name_table[rpcType][hash] = rpcMethodName;
10071007
#endif
10081008
}
10091009

1010-
#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
1010+
#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
10111011
[MethodImpl(MethodImplOptions.AggressiveInlining)]
10121012
private bool ValidateRpcMessageMetrics(Type type)
10131013
{
@@ -1125,7 +1125,7 @@ internal void InitializeVariables()
11251125
{
11261126
__rpc_func_table[GetType()] = new Dictionary<uint, RpcReceiveHandler>();
11271127
__rpc_permission_table[GetType()] = new Dictionary<uint, RpcInvokePermission>();
1128-
#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
1128+
#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
11291129
__rpc_name_table[GetType()] = new Dictionary<uint, string>();
11301130
#endif
11311131
__initializeRpcs();

com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviourUpdater.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class NetworkBehaviourUpdater
2727
/// </summary>
2828
private HashSet<NetworkObject> m_PendingDirtyNetworkObjects = new HashSet<NetworkObject>();
2929

30-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
30+
#if DEBUG
3131
private ProfilerMarker m_NetworkBehaviourUpdate = new ProfilerMarker($"{nameof(NetworkBehaviour)}.{nameof(NetworkBehaviourUpdate)}");
3232
#endif
3333

@@ -190,7 +190,7 @@ internal void ProcessDirtyObject(NetworkObject networkObject, bool forceSend)
190190
/// <param name="forceSend"> Refer to the <see cref="ProcessDirtyObject(NetworkObject, bool)"/> definition.</param>
191191
internal void NetworkBehaviourUpdate(bool forceSend = false)
192192
{
193-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
193+
#if DEBUG
194194
m_NetworkBehaviourUpdate.Begin();
195195
#endif
196196
try
@@ -214,7 +214,7 @@ internal void NetworkBehaviourUpdate(bool forceSend = false)
214214
}
215215
finally
216216
{
217-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
217+
#if DEBUG
218218
m_NetworkBehaviourUpdate.End();
219219
#endif
220220
}

com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private static void ResetStaticsOnLoad()
7070

7171
#pragma warning restore IDE1006 // restore naming rule violation check
7272

73-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
73+
#if DEBUG
7474
private static List<Type> s_SerializedType = new List<Type>();
7575
// This is used to control the serialized type not optimized messaging for integration test purposes
7676
internal static bool DisableNotOptimizedSerializedType;
@@ -1176,7 +1176,7 @@ public int MaximumFragmentedMessageSize
11761176

11771177
internal void Initialize(bool server)
11781178
{
1179-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
1179+
#if DEBUG
11801180
if (!DisableNotOptimizedSerializedType)
11811181
{
11821182
s_SerializedType.Clear();
@@ -1239,7 +1239,7 @@ internal void Initialize(bool server)
12391239

12401240
MessageManager.Hook(new NetworkManagerHooks(this));
12411241

1242-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
1242+
#if DEBUG
12431243
if (NetworkConfig.NetworkProfilingMetrics)
12441244
{
12451245
MessageManager.Hook(new ProfilingHooks());

com.unity.netcode.gameobjects/Runtime/Messaging/CustomMessageManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ public void SendNamedMessage(string messageName, IReadOnlyList<ulong> clientIds,
434434
/// <exception cref="OverflowException">Exception thrown in case validation fails</exception>
435435
private unsafe void ValidateMessageSize(FastBufferWriter messageStream, NetworkDelivery networkDelivery, bool isNamed)
436436
{
437-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
437+
#if DEBUG
438438
var maxNonFragmentedSize = m_NetworkManager.MessageManager.NonFragmentedMessageMaxSize - FastBufferWriter.GetWriteSize<NetworkMessageHeader>() - sizeof(NetworkBatchHeader);
439439
if (isNamed)
440440
{

com.unity.netcode.gameobjects/Runtime/Messaging/Messages/RpcMessages.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static void Handle(ref NetworkContext context, ref RpcMetadata metadata,
7171
return;
7272
}
7373

74-
#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
74+
#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
7575
networkBehaviour.TrackRpcMetricsReceive(ref metadata, ref context, payload.Length);
7676
#endif
7777

com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ internal unsafe void ProcessSendQueues()
849849
}
850850

851851
queueItem.Writer.Seek(0);
852-
#if UNITY_EDITOR || DEVELOPMENT_BUILD
852+
#if DEBUG
853853
// Skipping the Verify and sneaking the write mark in because we know it's fine.
854854
queueItem.Writer.Handle->AllowedWriteMark = sizeof(NetworkBatchHeader);
855855
#endif

com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/BaseRpcTarget.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected void CheckLockBeforeDispose()
5353
private protected void SendMessageToClient(NetworkBehaviour behaviour, ulong clientId, ref RpcMessage message, NetworkDelivery delivery)
5454
{
5555
var size = behaviour.NetworkManager.MessageManager.SendMessage(ref message, delivery, clientId);
56-
#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
56+
#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
5757
// Send to a specific client
5858
behaviour.TrackRpcMetricsSend(clientId, ref message, size);
5959
#endif

com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/LocalSendRpcTarget.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ internal override void Send(NetworkBehaviour behaviour, ref RpcMessage message,
4646
message.Handle(ref context);
4747
length = tempBuffer.Length;
4848
}
49-
#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
49+
#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
5050
// Local invocation sends to self
5151
behaviour.TrackRpcMetricsSend(m_NetworkManager.LocalClientId, ref message, length);
5252
#endif

com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ProxyRpcTargetGroup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ internal override void Send(NetworkBehaviour behaviour, ref RpcMessage message,
2424
}
2525
var proxyMessage = new ProxyMessage { Delivery = delivery, TargetClientIds = TargetClientIds.AsArray(), WrappedMessage = message };
2626
var size = behaviour.NetworkManager.MessageManager.SendMessage(ref proxyMessage, delivery, NetworkManager.ServerClientId);
27-
#if MULTIPLAYER_TOOLS && (DEVELOPMENT_BUILD || UNITY_EDITOR || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
27+
#if MULTIPLAYER_TOOLS && (DEBUG || UNITY_MP_TOOLS_NET_STATS_MONITOR_ENABLED_IN_RELEASE)
2828
foreach (var clientId in TargetClientIds)
2929
{
3030
behaviour.TrackRpcMetricsSend(clientId, ref message, size);

0 commit comments

Comments
 (0)