Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

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

Discussion in 'Unity Analytics' started by SebastianBitwave, Apr 26, 2023.

  1. SebastianBitwave

    SebastianBitwave

    Joined:
    Jul 8, 2022
    Posts:
    13
    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.
     
    mylastggeast likes this.
  2. mylastggeast

    mylastggeast

    Joined:
    Jun 14, 2021
    Posts:
    43
    I am experiencing the same issue, to me it started from 4.4.0
     
  3. mylastggeast

    mylastggeast

    Joined:
    Jun 14, 2021
    Posts:
    43
    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.
     
  4. MiTschMR

    MiTschMR

    Joined:
    Aug 28, 2018
    Posts:
    529
    mylastggeast likes this.