Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

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:
    3
    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:
    46
    I am experiencing the same issue, to me it started from 4.4.0
     
  3. mylastggeast

    mylastggeast

    Joined:
    Jun 14, 2021
    Posts:
    46
    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:
    336
    mylastggeast likes this.