Skip to content

Commit 0edb4d6

Browse files
update
Removing the erroneous NetworkMessageMetrics when MULTIPLAYER_TOOLS was not defined from NetworkConfig. Remove unused namespace and minor clean up.
1 parent 063e5c8 commit 0edb4d6

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

com.unity.netcode.gameobjects/Editor/NetworkManagerHelper.cs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Unity.Netcode.Editor.Configuration;
44
using UnityEditor;
55
using UnityEngine;
6-
using UnityEngine.Analytics;
76
using UnityEngine.SceneManagement;
87

98
namespace Unity.Netcode.Editor
@@ -226,7 +225,6 @@ public bool NotifyUserOfNestedNetworkManager(NetworkManager networkManager, bool
226225
return isParented;
227226
}
228227

229-
private const bool k_EnableAnalyticsLogging = true;
230228
/// <summary>
231229
/// Invoked from within <see cref="NetworkManager.ModeChanged"/> when exiting play mode.
232230
/// </summary>
@@ -242,17 +240,16 @@ public void UpdateAnalytics()
242240
for (int i = 0; i < NetworkManager.RecentSessions.Count; i++)
243241
{
244242
var networkManagerAnalytics = GetNetworkManagerAnalytics(NetworkManager.RecentSessions[i]);
245-
if (k_EnableAnalyticsLogging)
246-
{
247-
networkManagerAnalytics.LogAnalytics(NetworkManager.RecentSessions[i].SessionIndex);
248-
}
249-
243+
#if ENABLE_NGO_ANALYTICS_LOGGING
244+
networkManagerAnalytics.LogAnalytics(NetworkManager.RecentSessions[i].SessionIndex);
245+
#endif
250246
var result = EditorAnalytics.SendAnalytic(new NetworkManagerAnalyticsHandler(networkManagerAnalytics));
251-
247+
#if ENABLE_NGO_ANALYTICS_LOGGING
252248
if (result != AnalyticsResult.Ok)
253249
{
254250
Debug.LogWarning($"[Analytics] Problem sending analytics: {result}");
255251
}
252+
#endif
256253
}
257254
}
258255

@@ -265,11 +262,13 @@ private NetworkManagerAnalytics GetNetworkManagerAnalytics(NetworkManager.Networ
265262
{
266263
var multiplayerSDKInstalled = false;
267264
var multiplayerToolsInstalled = false;
265+
var networkMessageMetrics = false;
268266
#if MULTIPLAYER_SERVICES_SDK_INSTALLED
269267
multiplayerSDKInstalled = true;
270268
#endif
271269
#if MULTIPLAYER_TOOLS
272270
multiplayerToolsInstalled = true;
271+
networkMessageMetrics = networkSession.NetworkConfig.NetworkMessageMetrics;
273272
#endif
274273
if (!networkSession.SessionStopped)
275274
{
@@ -296,11 +295,7 @@ private NetworkManagerAnalytics GetNetworkManagerAnalytics(NetworkManager.Networ
296295
EnableTimeResync = networkSession.NetworkConfig.EnableTimeResync,
297296
TimeResyncInterval = networkSession.NetworkConfig.TimeResyncInterval,
298297
TickRate = (int)networkSession.NetworkConfig.TickRate,
299-
#if MULTIPLAYER_TOOLS
300-
NetworkMessageMetrics = networkSession.NetworkConfig.NetworkMessageMetrics,
301-
#else
302-
NetworkMessageMetrics = false,
303-
#endif
298+
NetworkMessageMetrics = networkMessageMetrics,
304299
NetworkProfilingMetrics = networkSession.NetworkConfig.NetworkProfilingMetrics,
305300
WasClient = networkSession.WasClient,
306301
WasServer = networkSession.WasServer,

com.unity.netcode.gameobjects/Runtime/Configuration/NetworkConfig.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ internal NetworkConfig Copy()
198198
AutoSpawnPlayerPrefabClientSide = AutoSpawnPlayerPrefabClientSide,
199199
#if MULTIPLAYER_TOOLS
200200
NetworkMessageMetrics = NetworkMessageMetrics,
201-
#else
202-
NetworkMessageMetrics = false,
203201
#endif
204202
NetworkProfilingMetrics = NetworkProfilingMetrics,
205203
};

0 commit comments

Comments
 (0)