Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"Unity.Networking.Transport",
"Unity.Services.Core",
"Unity.Services.Authentication",
"Unity.NetCode",
"Unity.NetCode.Editor"
"GUID:953adc2a6b8b4e3c8df5b728bcd546e9",
"GUID:eb8cf780bf058694ebf7ec5cf5b8cfa3"
],
"includePlatforms": [
"Editor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void Initialize(NetworkManager networkManager)
if (NetworkMetrics == null)
{
#if MULTIPLAYER_TOOLS
NetworkMetrics = new NetworkMetrics();
NetworkMetrics = new ToolsNetworkMetrics();
#else
NetworkMetrics = new NullNetworkMetrics();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@

namespace Unity.Netcode
{
internal class NetworkMetrics : INetworkMetrics
internal class ToolsNetworkMetrics : INetworkMetrics
{
private const ulong k_MaxMetricsPerFrame = 1000L;
private static readonly Dictionary<uint, string> k_SceneEventTypeNames;
private static readonly ProfilerMarker k_FrameDispatch;

static NetworkMetrics()
static ToolsNetworkMetrics()
{
k_SceneEventTypeNames = new Dictionary<uint, string>();
foreach (SceneEventType type in Enum.GetValues(typeof(SceneEventType)))
{
k_SceneEventTypeNames[(uint)type] = type.ToString();
}
k_FrameDispatch = new ProfilerMarker($"{nameof(NetworkMetrics)}.DispatchFrame");
// Spelled out rather than nameof: this is the name shown in the Profiler, and it
// should not move because the implementing type was renamed.
k_FrameDispatch = new ProfilerMarker("NetworkMetrics.DispatchFrame");
}

private static string GetSceneEventTypeName(uint typeCode)
Expand Down Expand Up @@ -85,7 +87,7 @@ private static string GetSceneEventTypeName(uint typeCode)

private ulong m_NumberOfMetricsThisFrame;

public NetworkMetrics()
public ToolsNetworkMetrics()
{
Dispatcher = new MetricDispatcherBuilder()
.WithCounters(m_TransportBytesSent, m_TransportBytesReceived)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"Unity.Collections",
"Unity.Burst",
"Unity.Mathematics",
"Unity.NetCode",
"GUID:953adc2a6b8b4e3c8df5b728bcd546e9",
"Unity.Entities"
],
"includePlatforms": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"Unity.Mathematics",
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"Unity.NetCode",
"GUID:953adc2a6b8b4e3c8df5b728bcd546e9",
"Unity.Entities"
],
"includePlatforms": [],
Expand Down