Search Unity

Application.persistentDataPath returning Empty String on some machines

Discussion in 'Scripting' started by sevensails, Feb 4, 2016.

  1. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    Tested on Unity 5.3.1 and Unity 5.3.2p1

    I have 2 machines here. Application.persistentDataPath is returning an empty string on Editor (Debug) and Windows x86 executables on 1 of these machines.

    I sent a build for an beta tester and he faced the same problem.

    Is this a known bug? It's hard to send a bug report because it seems to be something machine related (both are Using Windows 10).

    Thanks
     
  2. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    Tested on 5.3.2p2... The bug remains... is there something I can check?
     
  3. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    3,458
    Have a look in the log file. Any errors?
     
  4. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    No... nothing strange on output_log.txt.

    I created a workaround by using this folder and it's working :

    Code (csharp):
    1.  
    2. System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData)
    3.  
    How does Unity gets the APPLOW folder?
     
  5. mpgholden

    mpgholden

    Joined:
    Aug 21, 2014
    Posts:
    16
    Our team encountered this too, and the System.Environment.GetFolderPath workaround also resolved it for us. On 5.3.1p4.

    Application.persistentDataPath appears to be inconsistent. I know it failed on at least 2 Windows 10 machines and worked on at least 3 others. Our logs would show an error when it attempted to create a file at the empty string path.
     
    sevensails likes this.
  6. GerrardTooKind

    GerrardTooKind

    Joined:
    Sep 11, 2014
    Posts:
    3
    I have the same issue on 5.3.3p2 version (and already with the 5.3.3f1 version).

    Application.persistentDataPath is returning an empty string in editor. It happens on every computer we got here. (all running under windows 10)
     
  7. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    3,458
    Can you file a bug report with a sample project so we can take a look please.
     
  8. GerrardTooKind

    GerrardTooKind

    Joined:
    Sep 11, 2014
    Posts:
    3
    I don't really know what happened but it's working again now... Can't send you a bug report then ! Sorry.
     
  9. dimitroff

    dimitroff

    Joined:
    Apr 3, 2013
    Posts:
    103
    For us this problem appears very randomly when testing Android in Genymotion. But we see rare cases of errors reported from some devices.
     
  10. sandolkakos

    sandolkakos

    Joined:
    Jun 3, 2009
    Posts:
    187
    The carriage return ( \r ) character in the ProductName was breaking the line at end of the Path, so this is why Application.persistentDataPath was returning string.Empty.

    persistentdatapath-fix.png
     
  11. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    3,458
    Could you file a bug report, please? We could probably do something about this in the future.
     
  12. whizzkid

    whizzkid

    Joined:
    Nov 2, 2016
    Posts:
    7
    It also fails if you have a trailing space in the productname :)