Analytics accesses Application.persistentDataPath on platform where this leads to crashes

Hello,

We are using Analytics 4.4.1 on a certain platform (which I will not specify to avoid breaking NDA) where this leads to crashes.

The culprit is the DiskCache(IFileSystemCalls) constructor which does this:
k_CacheFilePath = $"{Application.persistentDataPath}/eventcache";

Embedding the package and replacing that line with this one fixes the crash:
k_CacheFilePath = systemCalls.CanAccessFileSystem() ? $"{Application.persistentDataPath}/eventcache" : "";

The rest of the file guards file operations with CanAccessFileSystem() so this is likely an oversight.

1 Like

I am experiencing the same issue, to me it started from 4.4.0

Bumping this since it’s quite critical as it prevents the package from being used on a console (unless the package is embedded). It would be nice to know if the Unity team has acknowledged the issue and will work on a fix in a future release.

Unity fixed this issue with version 5.0 of the Analytics package: Changelog | Analytics | 5.0.2

1 Like