Skip to content

Commit 635688f

Browse files
test - fix
I think integration tests failed on the first pass because EditorAnalytics.enabled is defaulted to false during CI. This update should resolve the issue if that is the case.
1 parent ac9cb1a commit 635688f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

com.unity.netcode.gameobjects/Editor/Analytics/NetcodeAnalytics.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ internal override void ModeChanged(PlayModeStateChange playModeState, NetworkMan
8787
/// <param name="networkManager">The <see cref="NetworkManager"/> instance when the session is started.</param>
8888
internal override void SessionStarted(NetworkManager networkManager)
8989
{
90-
// If analytics is disabled, then exit early
91-
if (!EditorAnalytics.enabled)
90+
// If analytics is disabled and we are not running an integration test, then exit early.
91+
if (!EditorAnalytics.enabled && !IsIntegrationTest)
9292
{
9393
return;
9494
}
@@ -111,8 +111,8 @@ internal override void SessionStarted(NetworkManager networkManager)
111111
/// <param name="networkManager">The <see cref="NetworkManager"/> instance.</param>
112112
internal override void SessionStopped(NetworkManager networkManager)
113113
{
114-
// If analytics is disabled or there are no sessions, then exit early
115-
if (!EditorAnalytics.enabled || RecentSessions.Count == 0)
114+
// If analytics is disabled and we are not running an integration test or there are no sessions, then exit early.
115+
if ((!EditorAnalytics.enabled && !IsIntegrationTest) || RecentSessions.Count == 0)
116116
{
117117
return;
118118
}
@@ -134,8 +134,8 @@ internal override void SessionStopped(NetworkManager networkManager)
134134
/// </summary>
135135
private void UpdateAnalytics(NetworkManager networkManager)
136136
{
137-
// Exit early if analytics is disabled or there are no sessions to process.
138-
if (!EditorAnalytics.enabled || RecentSessions.Count == 0)
137+
// If analytics is disabled and we are not running an integration test or there are no sessions to process, then exit early.
138+
if ((!EditorAnalytics.enabled && !IsIntegrationTest) || RecentSessions.Count == 0)
139139
{
140140
return;
141141
}
@@ -169,6 +169,7 @@ private void UpdateAnalytics(NetworkManager networkManager)
169169
continue;
170170
}
171171

172+
// If not running an integration test, then go ahead and send the anlytics event data.
172173
if (!IsIntegrationTest)
173174
{
174175
var result = EditorAnalytics.SendAnalytic(new NetworkManagerAnalyticsHandler(networkManagerAnalytics));

0 commit comments

Comments
 (0)