- Home /
Application.persistentDataPath is empty
Application.persistentDataPath is "" in some devices. I´m doing a simple:
Debug.Log(Application.persistentDataPath));
And in some iOS devices and PCs, it comes out as "". In other devices, it works fine. Has anyone experienced this before? It´s getting my users pretty upset, as some of them just cannot save anything they do in my app.
Unity 3.5.6f4
I've got the same problem, the difference is for the same mobile and the same version, sometimes is ok, sometimes the Application.persistentDataPath return empty, so why??? it is annoy, make me creazy all day, so help me pls!
Still see this problem in Unity 5.1.2. I see some Android devices get a blank Application.persistantDataPath via my analytics. Has anyone figured out a workaround?
I have the same Problem with Unity 5.1.3. Anyone have a solution to this?
Answer by infosekr · Sep 05, 2015 at 12:17 PM
Seems like the best approach is to avoid Application.persistantDataPath altogether, and write a Java plugin to get the Internal storage directory directly from the OS. Seems that the persistantDataPath can change based on if you have an SD card inserted or a USB cable plugged in anyway, not to mention why it returns an empty string for some users in particular situations.
Answer by haochen1991 · Nov 19, 2015 at 07:40 AM
Hi,I‘ve got the same problem,and then I slove it by rebuild the "ProjectSettings.asset"file,It worked.
How did you rebuild the projectsettings.asset file?
Answer by sandolkakos · Aug 21, 2018 at 01:43 PM
My problem was solved when I noticed the carriage return (/r) character in the ProductName of my project. Look here: https://forum.unity.com/threads/app...-string-on-some-machines.384000/#post-3604512
Answer by gvergidis · Aug 21, 2018 at 02:15 PM
Try using this instead :
System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData)
Your answer
![](https://koobas.hobune.stream/wayback/20220613093656im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
TimeSpan error on ios platform 2 Answers
Unity bugged after Ios Build 0 Answers
Enable iOS PlayerSettings on Windows? 2 Answers
UnityAction with method name with "Play" inside don't execute on iOS 0 Answers
Splashscreen problem on iOS 0 Answers