33using Unity . Netcode . Editor . Configuration ;
44using UnityEditor ;
55using UnityEngine ;
6- using UnityEngine . Analytics ;
76using UnityEngine . SceneManagement ;
87
98namespace 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 ,
0 commit comments