Unity Analytics creating folders & files even when disabled\uninstalled

Unity: 2022.3.47f1

Hello!

I have a project that early in the development cycle had Unity Analytics (new) enabled, but that was later disabled. The project is now close to beta, so I’ve been testing builds and have noticed that Unity still seems to think Analytics is enabled (in some shape or form)

So…

  1. Unity Analytics package (new) is not installed.
  2. Unity Analytics package (legacy) is not installed.
  3. Unity Analytics package (built-in) is disabled.

But when running the game in the editor, the following folder is created in the persistent data path (along with two files and a sub-folder)…

Unity\guid\Editor\Analytics

And when running the game on Android…

files\Unity\guid\Analytics

Given that the game declares no analytics are used and I’ve done everything possible to disable it, this could well raise questions with platforms and players.

Is anyone from Unity able to help with this please? (as I can only assume it’s a bug)

During development I have noticed that every time a project is saved (or a setting is changed) the Analytics Enabled setting changes from 0 to 1 (as shown in GitHub) and requires discarding…

UnityConnectSettings.asset
+UnityAnalyticsSettings:
++m_Enabled: 1

I wonder if this could be related to the issue? (i.e., it’s being enabled silently during the build process)

PS: Analytics is disabled in the Unity Dashboard and has no advertising packages installed, but does have Unity Purchasing installed (not codeless)

Update #1

It seems that the UnityConnectSettings.asset file contained the following setting…

UnityAnalyticsSettings:
+m_InitializeOnStartup: 1

So I set that to 0 and on running the game, it seemed to address the issue. That is, the analytics folders are not created.

However… as before, as soon as a setting is changed in the editor (or the project saved) the enabled flag is set back to 1 and the issue returns.

After some experimenting though, it seems that these folders are created by Unity Performance Reporting, even if it’s disabled in the UnityConnectSettings.asset file…

PerformanceReportingSettings:
+m_Enabled: 0

But if it’s disabled in code on startup…

[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void OnStartApplication()
{
  PerformanceReporting.enabled = false;
}

It seems to permanently address the issue, albeit I’ve only tested in the editor and not on a device build.

So I would say there are two bugs here…

  1. Why does the m_Enabled Analytics setting keep changing to 1
  2. Why is Unity Performance Reporting creating the folders even if m_Enabled is set to 0

Update #2

It seems disabling performance reporting in code is not helping, as reported above.

It was tested numerous times (closing Unity in-between) but I’ve just noticed the Analytics folders are being created again, even with the disable code being called on startup.

Is someone from Unity able to help out here please?

Hey Peachy,

Just from what I’ve read here, it sounds like it might be Cloud Diagnostics which is setting those variables and creating those folders. Are you using Cloud Diagnostics, and does this continue to happen if it’s switched off?

If we can isolate this to a specific package / part of the engine, I can pass the reports to the specific team responsible.

Cheers!

1 Like

Hey @unity_Ctri

Thanks for the reply.

The game does not have Cloud Diagnostics installed, as far as I can tell. It’s not listed in the package manager (built-in or installed) and does not show in the Services section of the Project Settings.

The only Unity packages installed (that might be relevant) are the CCD client & Unity Purchasing. The game has no analytics, diagnostics or advertising packages\SDK’s installed, Unity or otherwise. Unity Analytics was once installed, but removed a long time ago.

Today I ran some tests and in terms of sequencing, determined where\when the folders are being created…

  1. [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] - Folders do not exist
  2. Initial scene loading\loaded - Folders are created
  3. My game code initialises (including Unity Purchasing etc)

So it looks like it’s internal to Unity and early in the process.

Strangely the folders are only created the first time the game is run in the editor. If you stop the game (without closing Unity) delete the folders then press play again, the folders are not recreated.

Close & re-open Unity then re-run the game and the folders will be created again.

1 Like

Hey @unity_Ctri

Is there anything else you can suggest that might help isolate the issue please?

Yesterday I created an IAP Catalogue file (IAPProductCatalog.json) as I know IAP contains Analytics calls.

I set both the auto initialise fields to false

"enableCodelessAutoInitialization":false,"enableUnityGamingServicesAutoInitialization":false

…then started the game again (with the folders deleted) but it re-created them, so it looks like this can be ruled out as well.

Hey @unity_Ctri

Just reporting some more findings…

I added some logging code (to the start scene) and found out that the Analytics folder is created before the Start method is called (on the game boot component)

I also completely removed Unity Purchasing from the project (that is, all my code & uninstalled the package) and the Analytics folder is still created.

Finally I created a new empty scene (in the same project) and ran that and the folder is still created.

So I suspect this is either…

  1. The Unity editor\runtime
  2. The built-in Analytics (is still running in some shape or form)
  3. The m_Enabled setting (in UnityConnectSettings.asset) that keeps being enabled (whenever updating settings or saving a project)

Does that narrow it down enough for you to pass this onto the relevant engineering teams?