Skip to content

Commit 2fb5e8c

Browse files
author
Jean-Sébastien Fauteux
authored
fix: Removing MLAPI Profiler for 2020.2 and higher (fix #595) (#612)
* fix: renamed define to remove MLAPI Profiler * Renaming other instances of UNITY_2020_2_OR_LATER to UNITY_2020_2_OR_NEWER
1 parent 2fdbdec commit 2fb5e8c

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

com.unity.multiplayer.mlapi/Editor/MLAPIProfiler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace UnityEditor
88
{
99
public class MLAPIProfiler : EditorWindow
1010
{
11-
#if !UNITY_2020_2_OR_LATER
11+
#if !UNITY_2020_2_OR_NEWER
1212
[MenuItem("Window/MLAPI Profiler")]
1313
public static void ShowWindow()
1414
{
@@ -358,4 +358,4 @@ private GUIStyle GetStyleWithTextAlpha(GUIStyle style, float alpha)
358358
return newStyle;
359359
}
360360
}
361-
}
361+
}

com.unity.multiplayer.mlapi/Runtime/Core/NetworkManager.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ public void Shutdown()
609609
NetworkTickSystem = null;
610610
}
611611

612-
#if !UNITY_2020_2_OR_LATER
612+
#if !UNITY_2020_2_OR_NEWER
613613
NetworkProfiler.Stop();
614614
#endif
615615
IsListening = false;
@@ -661,7 +661,7 @@ private void OnNetworkEarlyUpdate()
661661
#endif
662662
var isLoopBack = false;
663663

664-
#if !UNITY_2020_2_OR_LATER
664+
#if !UNITY_2020_2_OR_NEWER
665665
NetworkProfiler.StartTick(TickType.Receive);
666666
#endif
667667

@@ -682,7 +682,7 @@ private void OnNetworkEarlyUpdate()
682682

683683
m_LastReceiveTickTime = NetworkTime;
684684

685-
#if !UNITY_2020_2_OR_LATER
685+
#if !UNITY_2020_2_OR_NEWER
686686
NetworkProfiler.EndTick();
687687
#endif
688688

@@ -702,7 +702,7 @@ private void OnNetworkPreUpdate()
702702
#if DEVELOPMENT_BUILD || UNITY_EDITOR
703703
s_EventTick.Begin();
704704
#endif
705-
#if UNITY_EDITOR && !UNITY_2020_2_OR_LATER
705+
#if UNITY_EDITOR && !UNITY_2020_2_OR_NEWER
706706
NetworkProfiler.StartTick(TickType.Event);
707707
#endif
708708

@@ -721,7 +721,7 @@ private void OnNetworkPreUpdate()
721721
{
722722
m_LastEventTickTime = NetworkTime;
723723
}
724-
#if UNITY_EDITOR && !UNITY_2020_2_OR_LATER
724+
#if UNITY_EDITOR && !UNITY_2020_2_OR_NEWER
725725
NetworkProfiler.EndTick();
726726
#endif
727727

@@ -732,12 +732,12 @@ private void OnNetworkPreUpdate()
732732

733733
if (IsServer && NetworkConfig.EnableTimeResync && NetworkTime - m_LastTimeSyncTime >= NetworkConfig.TimeResyncInterval)
734734
{
735-
#if UNITY_EDITOR && !UNITY_2020_2_OR_LATER
735+
#if UNITY_EDITOR && !UNITY_2020_2_OR_NEWER
736736
NetworkProfiler.StartTick(TickType.Event);
737737
#endif
738738
SyncTime();
739739
m_LastTimeSyncTime = NetworkTime;
740-
#if UNITY_EDITOR && !UNITY_2020_2_OR_LATER
740+
#if UNITY_EDITOR && !UNITY_2020_2_OR_NEWER
741741
NetworkProfiler.EndTick();
742742
#endif
743743
}
@@ -831,7 +831,7 @@ private void HandleRawTransportPoll(NetworkEvent networkEvent, ulong clientId, N
831831
#if DEVELOPMENT_BUILD || UNITY_EDITOR
832832
s_TransportConnect.Begin();
833833
#endif
834-
#if !UNITY_2020_2_OR_LATER
834+
#if !UNITY_2020_2_OR_NEWER
835835
NetworkProfiler.StartEvent(TickType.Receive, (uint)payload.Count, networkChannel, "TRANSPORT_CONNECT");
836836
#endif
837837
if (IsServer)
@@ -860,7 +860,7 @@ private void HandleRawTransportPoll(NetworkEvent networkEvent, ulong clientId, N
860860
StartCoroutine(ApprovalTimeout(clientId));
861861
}
862862

863-
#if !UNITY_2020_2_OR_LATER
863+
#if !UNITY_2020_2_OR_NEWER
864864
NetworkProfiler.EndEvent();
865865
#endif
866866
#if DEVELOPMENT_BUILD || UNITY_EDITOR
@@ -881,7 +881,7 @@ private void HandleRawTransportPoll(NetworkEvent networkEvent, ulong clientId, N
881881
#if DEVELOPMENT_BUILD || UNITY_EDITOR
882882
s_TransportDisconnect.Begin();
883883
#endif
884-
#if !UNITY_2020_2_OR_LATER
884+
#if !UNITY_2020_2_OR_NEWER
885885
NetworkProfiler.StartEvent(TickType.Receive, 0, NetworkChannel.Internal, "TRANSPORT_DISCONNECT");
886886
#endif
887887

@@ -899,7 +899,7 @@ private void HandleRawTransportPoll(NetworkEvent networkEvent, ulong clientId, N
899899

900900
OnClientDisconnectCallback?.Invoke(clientId);
901901

902-
#if !UNITY_2020_2_OR_LATER
902+
#if !UNITY_2020_2_OR_NEWER
903903
NetworkProfiler.EndEvent();
904904
#endif
905905
#if DEVELOPMENT_BUILD || UNITY_EDITOR
@@ -950,7 +950,7 @@ internal void HandleIncomingData(ulong clientId, NetworkChannel networkChannel,
950950

951951
uint headerByteSize = (uint)Arithmetic.VarIntSize(messageType);
952952

953-
#if !UNITY_2020_2_OR_LATER
953+
#if !UNITY_2020_2_OR_NEWER
954954
NetworkProfiler.StartEvent(TickType.Receive, (uint)(data.Count - headerByteSize), networkChannel, messageType);
955955
#endif
956956

@@ -1082,7 +1082,7 @@ internal void HandleIncomingData(ulong clientId, NetworkChannel networkChannel,
10821082

10831083
#endregion
10841084

1085-
#if !UNITY_2020_2_OR_LATER
1085+
#if !UNITY_2020_2_OR_NEWER
10861086
NetworkProfiler.EndEvent();
10871087
#endif
10881088
}

com.unity.multiplayer.mlapi/Runtime/Messaging/InternalMessageSender.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ internal static void Send(ulong clientId, byte messageType, NetworkChannel netwo
2424
ProfilerStatManager.BytesSent.Record((int)buffer.Length);
2525
PerformanceDataManager.Increment(ProfilerConstants.NumberBytesSent, (int)buffer.Length);
2626

27-
#if !UNITY_2020_2_OR_LATER
27+
#if !UNITY_2020_2_OR_NEWER
2828
NetworkProfiler.EndEvent();
2929
#endif
3030
}
@@ -36,7 +36,7 @@ internal static void Send(byte messageType, NetworkChannel networkChannel, Netwo
3636

3737
using (var buffer = MessagePacker.WrapMessage(messageType, messageBuffer))
3838
{
39-
#if !UNITY_2020_2_OR_LATER
39+
#if !UNITY_2020_2_OR_NEWER
4040
NetworkProfiler.StartEvent(TickType.Send, (uint)buffer.Length, networkChannel, NetworkConstants.MESSAGE_NAMES[messageType]);
4141
#endif
4242

@@ -49,7 +49,7 @@ internal static void Send(byte messageType, NetworkChannel networkChannel, Netwo
4949
PerformanceDataManager.Increment(ProfilerConstants.NumberBytesSent, (int)buffer.Length);
5050
}
5151

52-
#if !UNITY_2020_2_OR_LATER
52+
#if !UNITY_2020_2_OR_NEWER
5353
NetworkProfiler.EndEvent();
5454
#endif
5555
}
@@ -67,7 +67,7 @@ internal static void Send(byte messageType, NetworkChannel networkChannel, List<
6767

6868
using (var buffer = MessagePacker.WrapMessage(messageType, messageBuffer))
6969
{
70-
#if !UNITY_2020_2_OR_LATER
70+
#if !UNITY_2020_2_OR_NEWER
7171
NetworkProfiler.StartEvent(TickType.Send, (uint)buffer.Length, networkChannel, NetworkConstants.MESSAGE_NAMES[messageType]);
7272
#endif
7373

@@ -80,7 +80,7 @@ internal static void Send(byte messageType, NetworkChannel networkChannel, List<
8080
PerformanceDataManager.Increment(ProfilerConstants.NumberBytesSent, (int)buffer.Length);
8181
}
8282

83-
#if !UNITY_2020_2_OR_LATER
83+
#if !UNITY_2020_2_OR_NEWER
8484
NetworkProfiler.EndEvent();
8585
#endif
8686
}
@@ -92,7 +92,7 @@ internal static void Send(byte messageType, NetworkChannel networkChannel, ulong
9292

9393
using (var buffer = MessagePacker.WrapMessage(messageType, messageBuffer))
9494
{
95-
#if !UNITY_2020_2_OR_LATER
95+
#if !UNITY_2020_2_OR_NEWER
9696
NetworkProfiler.StartEvent(TickType.Send, (uint)buffer.Length, networkChannel, NetworkConstants.MESSAGE_NAMES[messageType]);
9797
#endif
9898

@@ -109,10 +109,10 @@ internal static void Send(byte messageType, NetworkChannel networkChannel, ulong
109109
PerformanceDataManager.Increment(ProfilerConstants.NumberBytesSent, (int)buffer.Length);
110110
}
111111

112-
#if !UNITY_2020_2_OR_LATER
112+
#if !UNITY_2020_2_OR_NEWER
113113
NetworkProfiler.EndEvent();
114114
#endif
115115
}
116116
}
117117
}
118-
}
118+
}

0 commit comments

Comments
 (0)