Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions com.unity.multiplayer.mlapi/Editor/MLAPIProfiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace UnityEditor
{
public class MLAPIProfiler : EditorWindow
{
#if !UNITY_2020_2_OR_LATER
#if !UNITY_2020_2_OR_NEWER
[MenuItem("Window/MLAPI Profiler")]
public static void ShowWindow()
{
Expand Down Expand Up @@ -358,4 +358,4 @@ private GUIStyle GetStyleWithTextAlpha(GUIStyle style, float alpha)
return newStyle;
}
}
}
}
26 changes: 13 additions & 13 deletions com.unity.multiplayer.mlapi/Runtime/Core/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ public void Shutdown()
NetworkTickSystem = null;
}

#if !UNITY_2020_2_OR_LATER
#if !UNITY_2020_2_OR_NEWER
NetworkProfiler.Stop();
#endif
IsListening = false;
Expand Down Expand Up @@ -661,7 +661,7 @@ private void OnNetworkEarlyUpdate()
#endif
var isLoopBack = false;

#if !UNITY_2020_2_OR_LATER
#if !UNITY_2020_2_OR_NEWER
NetworkProfiler.StartTick(TickType.Receive);
#endif

Expand All @@ -682,7 +682,7 @@ private void OnNetworkEarlyUpdate()

m_LastReceiveTickTime = NetworkTime;

#if !UNITY_2020_2_OR_LATER
#if !UNITY_2020_2_OR_NEWER
NetworkProfiler.EndTick();
#endif

Expand All @@ -702,7 +702,7 @@ private void OnNetworkPreUpdate()
#if DEVELOPMENT_BUILD || UNITY_EDITOR
s_EventTick.Begin();
#endif
#if UNITY_EDITOR && !UNITY_2020_2_OR_LATER
#if UNITY_EDITOR && !UNITY_2020_2_OR_NEWER
NetworkProfiler.StartTick(TickType.Event);
#endif

Expand All @@ -721,7 +721,7 @@ private void OnNetworkPreUpdate()
{
m_LastEventTickTime = NetworkTime;
}
#if UNITY_EDITOR && !UNITY_2020_2_OR_LATER
#if UNITY_EDITOR && !UNITY_2020_2_OR_NEWER
NetworkProfiler.EndTick();
#endif

Expand All @@ -732,12 +732,12 @@ private void OnNetworkPreUpdate()

if (IsServer && NetworkConfig.EnableTimeResync && NetworkTime - m_LastTimeSyncTime >= NetworkConfig.TimeResyncInterval)
{
#if UNITY_EDITOR && !UNITY_2020_2_OR_LATER
#if UNITY_EDITOR && !UNITY_2020_2_OR_NEWER
NetworkProfiler.StartTick(TickType.Event);
#endif
SyncTime();
m_LastTimeSyncTime = NetworkTime;
#if UNITY_EDITOR && !UNITY_2020_2_OR_LATER
#if UNITY_EDITOR && !UNITY_2020_2_OR_NEWER
NetworkProfiler.EndTick();
#endif
}
Expand Down Expand Up @@ -831,7 +831,7 @@ private void HandleRawTransportPoll(NetworkEvent networkEvent, ulong clientId, N
#if DEVELOPMENT_BUILD || UNITY_EDITOR
s_TransportConnect.Begin();
#endif
#if !UNITY_2020_2_OR_LATER
#if !UNITY_2020_2_OR_NEWER
NetworkProfiler.StartEvent(TickType.Receive, (uint)payload.Count, networkChannel, "TRANSPORT_CONNECT");
#endif
if (IsServer)
Expand Down Expand Up @@ -860,7 +860,7 @@ private void HandleRawTransportPoll(NetworkEvent networkEvent, ulong clientId, N
StartCoroutine(ApprovalTimeout(clientId));
}

#if !UNITY_2020_2_OR_LATER
#if !UNITY_2020_2_OR_NEWER
NetworkProfiler.EndEvent();
#endif
#if DEVELOPMENT_BUILD || UNITY_EDITOR
Expand All @@ -881,7 +881,7 @@ private void HandleRawTransportPoll(NetworkEvent networkEvent, ulong clientId, N
#if DEVELOPMENT_BUILD || UNITY_EDITOR
s_TransportDisconnect.Begin();
#endif
#if !UNITY_2020_2_OR_LATER
#if !UNITY_2020_2_OR_NEWER
NetworkProfiler.StartEvent(TickType.Receive, 0, NetworkChannel.Internal, "TRANSPORT_DISCONNECT");
#endif

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

OnClientDisconnectCallback?.Invoke(clientId);

#if !UNITY_2020_2_OR_LATER
#if !UNITY_2020_2_OR_NEWER
NetworkProfiler.EndEvent();
#endif
#if DEVELOPMENT_BUILD || UNITY_EDITOR
Expand Down Expand Up @@ -950,7 +950,7 @@ internal void HandleIncomingData(ulong clientId, NetworkChannel networkChannel,

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

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

Expand Down Expand Up @@ -1082,7 +1082,7 @@ internal void HandleIncomingData(ulong clientId, NetworkChannel networkChannel,

#endregion

#if !UNITY_2020_2_OR_LATER
#if !UNITY_2020_2_OR_NEWER
NetworkProfiler.EndEvent();
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal static void Send(ulong clientId, byte messageType, NetworkChannel netwo
ProfilerStatManager.BytesSent.Record((int)buffer.Length);
PerformanceDataManager.Increment(ProfilerConstants.NumberBytesSent, (int)buffer.Length);

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

using (var buffer = MessagePacker.WrapMessage(messageType, messageBuffer))
{
#if !UNITY_2020_2_OR_LATER
#if !UNITY_2020_2_OR_NEWER
NetworkProfiler.StartEvent(TickType.Send, (uint)buffer.Length, networkChannel, NetworkConstants.MESSAGE_NAMES[messageType]);
#endif

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

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

using (var buffer = MessagePacker.WrapMessage(messageType, messageBuffer))
{
#if !UNITY_2020_2_OR_LATER
#if !UNITY_2020_2_OR_NEWER
NetworkProfiler.StartEvent(TickType.Send, (uint)buffer.Length, networkChannel, NetworkConstants.MESSAGE_NAMES[messageType]);
#endif

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

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

using (var buffer = MessagePacker.WrapMessage(messageType, messageBuffer))
{
#if !UNITY_2020_2_OR_LATER
#if !UNITY_2020_2_OR_NEWER
NetworkProfiler.StartEvent(TickType.Send, (uint)buffer.Length, networkChannel, NetworkConstants.MESSAGE_NAMES[messageType]);
#endif

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

#if !UNITY_2020_2_OR_LATER
#if !UNITY_2020_2_OR_NEWER
NetworkProfiler.EndEvent();
#endif
}
}
}
}
}