I cannot find my file saved in the Asset from an Android device. It works well in the editor.
My code:
var path = Application.streamingAssetsPath + "/FilePos";
filePos = new ES3File(path);
if (!filePos.KeyExists(_KeyDataGame.keySaveFilePos))
{
print("coultn't find the file");
}
ES3File: Couldn't find the file on Android device.
Re: ES3File: Couldn't find the file on Android device.
Hi there,
Steaming Assets Path is not writable at runtime on Android (see https://docs.unity3d.com/Manual/StreamingAssets.html).
You should use Application.persistentDataPath instead, which Easy Save uses by default if you only specify a filename or relative path.
All the best,
Joel
Steaming Assets Path is not writable at runtime on Android (see https://docs.unity3d.com/Manual/StreamingAssets.html).
You should use Application.persistentDataPath instead, which Easy Save uses by default if you only specify a filename or relative path.
All the best,
Joel
Re: ES3File: Couldn't find the file on Android device.
I have a file to save the location of a gameObject created from the editor. How to load on Android?Joel wrote:Hi there,
Steaming Assets Path is not writable at runtime on Android (see https://docs.unity3d.com/Manual/StreamingAssets.html).
You should use Application.persistentDataPath instead, which Easy Save uses by default if you only specify a filename or relative path.
All the best,
Joel
I used the paths is Application.StreamingAssets, Application.persistentDataPath and Application.dataPath.
Re: ES3File: Couldn't find the file on Android device.
Hi there,
If you want to include a file in the built player, you should use a Resources folder:
https://docs.moodkie.com/easy-save-3/es ... resources/
All the best,
Joel
If you want to include a file in the built player, you should use a Resources folder:
https://docs.moodkie.com/easy-save-3/es ... resources/
All the best,
Joel
Re: ES3File: Couldn't find the file on Android device.
It works, thank you very much.Joel wrote:Hi there,
If you want to include a file in the built player, you should use a Resources folder:
https://docs.moodkie.com/easy-save-3/es ... resources/
All the best,
Joel
Re: ES3File: Couldn't find the file on Android device.
Hi Joel,Joel wrote:Hi there,
All the best,
Joel
Now, I want to load a file from is SerializeField in the inspector. How does it?
Loading a file from a resource path seems to take quite a while.
I think it would be faster to load it from an inspector or scriptableobject.
Thanks for considering my request.
Re: ES3File: Couldn't find the file on Android device.
Hi there,
You can use ES3File.LoadRawString to get an ES3File as a string, and the ES3File Constructor which accepts a byte array to load the data. I.e.
Joel
You can use ES3File.LoadRawString to get an ES3File as a string, and the ES3File Constructor which accepts a byte array to load the data. I.e.
var es3file = new ES3File(System.Text.Encoding.UTF8.GetBytes( yourFileAsAString ));All the best,
Joel
Re: ES3File: Couldn't find the file on Android device.
Hi Joel,Joel wrote:
Joel
How to save a file in run time. i created it in resource folder?
Thanks.
Re: ES3File: Couldn't find the file on Android device.
Hi there,jwiden wrote:Hi Joel,Joel wrote:
Joel
How to save a file in run time. i created it in resource folder?
Thanks.
It's not possible to save to the Resources file at runtime because Unity compiles it into the executable.
If you wanted to copy the data from the file in Resources to a file on the users device, you could do the following:
var resourcesSettings = new ES3Settings(); settings.saveLocation = ES3.Location.Resources; ES3.SaveRaw("MyFile.bytes", ES3.LoadRaw("MyFile.bytes", resourcesSettings));All the best,
Joel