@@ -231,25 +231,33 @@ public bool NotifyUserOfNestedNetworkManager(NetworkManager networkManager, bool
231231 public void UpdateAnalytics ( )
232232 {
233233 // Exit early if analytics is disabled
234- if ( ! EditorAnalytics . enabled )
234+ if ( ! EditorAnalytics . enabled || NetworkManager . RecentSessions . Count == 0 )
235235 {
236236 return ;
237237 }
238238
239+ var previousAnalytics = new NetworkManagerAnalytics ( ) ;
239240 // Parse through all of the recent network sessions to generate and send NetworkManager analytics
240241 for ( int i = 0 ; i < NetworkManager . RecentSessions . Count ; i ++ )
241242 {
242243 var networkManagerAnalytics = GetNetworkManagerAnalytics ( NetworkManager . RecentSessions [ i ] ) ;
244+
243245#if ENABLE_NGO_ANALYTICS_LOGGING
244246 networkManagerAnalytics . LogAnalytics ( NetworkManager . RecentSessions [ i ] . SessionIndex ) ;
245247#endif
248+ // If the previous session has no changes to the configuration then skip it (only unique configurations)
249+ if ( previousAnalytics . Equals ( networkManagerAnalytics ) )
250+ {
251+ continue ;
252+ }
246253 var result = EditorAnalytics . SendAnalytic ( new NetworkManagerAnalyticsHandler ( networkManagerAnalytics ) ) ;
247254#if ENABLE_NGO_ANALYTICS_LOGGING
248255 if ( result != AnalyticsResult . Ok )
249256 {
250257 Debug . LogWarning ( $ "[Analytics] Problem sending analytics: { result } ") ;
251258 }
252259#endif
260+ previousAnalytics = networkManagerAnalytics ;
253261 }
254262 }
255263
@@ -261,45 +269,26 @@ public void UpdateAnalytics()
261269 private NetworkManagerAnalytics GetNetworkManagerAnalytics ( NetworkManager . NetworkSessionInfo networkSession )
262270 {
263271 var multiplayerSDKInstalled = false ;
264- var multiplayerToolsInstalled = false ;
265- var networkMessageMetrics = false ;
266272#if MULTIPLAYER_SERVICES_SDK_INSTALLED
267273 multiplayerSDKInstalled = true ;
268274#endif
269- #if MULTIPLAYER_TOOLS
270- multiplayerToolsInstalled = true ;
271- networkMessageMetrics = networkSession . NetworkConfig . NetworkMessageMetrics ;
272- #endif
275+ #if ENABLE_NGO_ANALYTICS_LOGGING
273276 if ( ! networkSession . SessionStopped )
274277 {
275278 Debug . LogWarning ( $ "Session-{ networkSession . SessionIndex } was not considered stopped!") ;
276279 }
280+ #endif
281+
277282 var networkManagerAnalytics = new NetworkManagerAnalytics ( )
278283 {
279- NetworkTopology = networkSession . NetworkConfig . NetworkTopology . ToString ( ) ,
284+ IsDistributedAuthority = networkSession . NetworkConfig . NetworkTopology == NetworkTopologyTypes . DistributedAuthority ,
285+ WasServer = networkSession . WasServer ,
286+ WasClient = networkSession . WasClient ,
280287 UsedCMBService = networkSession . UsedCMBService ,
281- NetworkTransport = networkSession . Transport ,
282288 IsUsingMultiplayerSDK = multiplayerSDKInstalled ,
283- IsUsingMultiplayerTools = multiplayerToolsInstalled ,
284- PlayerPrefabSet = networkSession . PlayerPrefab ,
285- ConnectionApproval = networkSession . NetworkConfig . ConnectionApproval ,
286- ClientConnectionBufferTimeout = networkSession . NetworkConfig . ClientConnectionBufferTimeout ,
287- EnsureNetworkVariableLengthSafety = networkSession . NetworkConfig . EnsureNetworkVariableLengthSafety ,
289+ NetworkTransport = networkSession . Transport ,
288290 EnableSceneManagement = networkSession . NetworkConfig . EnableSceneManagement ,
289- LoadSceneTimeOut = networkSession . NetworkConfig . LoadSceneTimeOut ,
290- SpawnTimeout = networkSession . NetworkConfig . SpawnTimeout ,
291- ForceSamePrefabs = networkSession . NetworkConfig . ForceSamePrefabs ,
292- RecycleNetworkIds = networkSession . NetworkConfig . RecycleNetworkIds ,
293- NetworkIdRecycleDelay = networkSession . NetworkConfig . NetworkIdRecycleDelay ,
294- RpcHashSize = networkSession . NetworkConfig . RpcHashSize == HashSize . VarIntFourBytes ? 4 : 8 ,
295- EnableTimeResync = networkSession . NetworkConfig . EnableTimeResync ,
296- TimeResyncInterval = networkSession . NetworkConfig . TimeResyncInterval ,
297291 TickRate = ( int ) networkSession . NetworkConfig . TickRate ,
298- NetworkMessageMetrics = networkMessageMetrics ,
299- NetworkProfilingMetrics = networkSession . NetworkConfig . NetworkProfilingMetrics ,
300- WasClient = networkSession . WasClient ,
301- WasServer = networkSession . WasServer ,
302- SessionDuration = networkSession . SessionEnd - networkSession . SessionStart ,
303292 } ;
304293 return networkManagerAnalytics ;
305294 }
0 commit comments