Hi there,
Data from the persistent data path isn't transferred from the Editor over to your builds.
If you want data to be included from the Editor in your build you would need to put it in the Resources folder. Then if the file doesn't exist in the persistent data path, load it from Resources and re-save it in the persistent data path. All saving must be done in the persistent data path at runtime.
All the best,
Joel
Saving and loading a CSV spreadsheet using PlayMaker
-
- Posts: 14
- Joined: Thu Apr 30, 2020 10:39 pm
Re: Saving and loading a CSV spreadsheet using PlayMaker
Thanks for the explanation Joel! As a non-coder building this whole game strictly via Playmaker, learning about the Editor itself has been patchwork at best. These details about setting things up for Android aren't obvious so thank-you!
There's a triangle of logic I'm trying to get my head around as I implement this recommendation:
(My Unity Editor is setup with the EasySave3 Runtime Settings Location/Directory to 'File'/'Persistent Data Path'. So by default, all ES3 Playmaker actions are pointing to that persistent path when I try to save/load as I understand it now.)
Does this mean for save/load to work on Android, I need to:
- Keep my editor Runtime Settings pointing to File/Persistent Data Path
- Load .CSV from my Resources folder
- Save .CSV via the Persistent Data Path
- Somehow copy my saved files from the Persistent Data Path to my Resources folder so that when I load again, I get the newest data (maybe using the ES3 Copy File action?)
- Somehow use the Resources path when trying to load, even though the editor (and thus build) is pointing to the Persistent Data Path (maybe using the 'Override Default Settings' on the action trying to load in my FSM so it uses the Resources folder instead of the Persistent Data Path?)
Because my Runtime Settings are already setup to File/Persistent Data Path, all saving and loading seems to universally try to use that file path. I understand leaving it set to the Persistent Data Path because that's the only path Android can write to (thanks again for clearing this up for me!), but to then copy my saved data over to the Resources folder, would I use the ES3 action 'Copy File'?
If so, I'm guessing "Old File Path" is already rooted at the Persistent Data Path, but what exactly would be the "New File Path" knowing that it will be on Android? The Resources folder currently has my typical C:\\Unity\. . . type path but when this builds for Android, is there some kind of naming convention for the Resources path everyone just knows (that I'm probably missing out on because of doing this all via Playmaker )
Also, once I get the .CSV copied from the Persistent Data Path to the Resources folder, would I have to activate the 'Override Default Settings' on the action trying to load in my FSM so it uses the Resources folder instead of the Persistent Data Path?
I'm sorry this thread is going on for so long! I honestly don't mean to be a bother. Maybe there's an Easy Save 3 demo using Playmaker I could reference that already works on Android? Or even more, I'm willing to hire you for 30 minutes to connect over Discord and just walk through the fix? I get the feeling this is something really simple and it's just me not understanding where things need to be clicked/setup. You're gonna look at this project and be "Peter, look, just put this path here, click this button, now build. It should work." Like, this is probably such a simple fix it would take a guru like you 3 minutes to solve.
But so far, I've been struggling to understand the setup between the player sitting in the Android game wanting to save/load some data and the build not having either the Persistent Data Path (to save) or Resources folder (to load) setup correctly (this is the triangle of confusion I was mentioning earlier). If you don't think this can be explained-out here, I'm serious about hiring you and connecting over Discord just to solve my ignorance, please let me know!
There's a triangle of logic I'm trying to get my head around as I implement this recommendation:
(My Unity Editor is setup with the EasySave3 Runtime Settings Location/Directory to 'File'/'Persistent Data Path'. So by default, all ES3 Playmaker actions are pointing to that persistent path when I try to save/load as I understand it now.)
Does this mean for save/load to work on Android, I need to:
- Keep my editor Runtime Settings pointing to File/Persistent Data Path
- Load .CSV from my Resources folder
- Save .CSV via the Persistent Data Path
- Somehow copy my saved files from the Persistent Data Path to my Resources folder so that when I load again, I get the newest data (maybe using the ES3 Copy File action?)
- Somehow use the Resources path when trying to load, even though the editor (and thus build) is pointing to the Persistent Data Path (maybe using the 'Override Default Settings' on the action trying to load in my FSM so it uses the Resources folder instead of the Persistent Data Path?)
Because my Runtime Settings are already setup to File/Persistent Data Path, all saving and loading seems to universally try to use that file path. I understand leaving it set to the Persistent Data Path because that's the only path Android can write to (thanks again for clearing this up for me!), but to then copy my saved data over to the Resources folder, would I use the ES3 action 'Copy File'?
If so, I'm guessing "Old File Path" is already rooted at the Persistent Data Path, but what exactly would be the "New File Path" knowing that it will be on Android? The Resources folder currently has my typical C:\\Unity\. . . type path but when this builds for Android, is there some kind of naming convention for the Resources path everyone just knows (that I'm probably missing out on because of doing this all via Playmaker )
Also, once I get the .CSV copied from the Persistent Data Path to the Resources folder, would I have to activate the 'Override Default Settings' on the action trying to load in my FSM so it uses the Resources folder instead of the Persistent Data Path?
I'm sorry this thread is going on for so long! I honestly don't mean to be a bother. Maybe there's an Easy Save 3 demo using Playmaker I could reference that already works on Android? Or even more, I'm willing to hire you for 30 minutes to connect over Discord and just walk through the fix? I get the feeling this is something really simple and it's just me not understanding where things need to be clicked/setup. You're gonna look at this project and be "Peter, look, just put this path here, click this button, now build. It should work." Like, this is probably such a simple fix it would take a guru like you 3 minutes to solve.
But so far, I've been struggling to understand the setup between the player sitting in the Android game wanting to save/load some data and the build not having either the Persistent Data Path (to save) or Resources folder (to load) setup correctly (this is the triangle of confusion I was mentioning earlier). If you don't think this can be explained-out here, I'm serious about hiring you and connecting over Discord just to solve my ignorance, please let me know!
Re: Saving and loading a CSV spreadsheet using PlayMaker
Hi there,
This is the logic you should follow:
The 'File Exists' state will only ever be true when the player loads the application for the first time. At this point it will copy the file from Resources to the persistent data path, and then you never need to use Resources again.
All the best,
Joel
Just to clarify, this isn't specific to Android but is the case when building for any platform.TipOfTheDay wrote: ↑Sun May 21, 2023 11:43 amThese details about setting things up for Android aren't obvious so thank-you!
This is the logic you should follow:
- When your application first loads, use the ES3.FileExists action to check whether the file exists in the persistent data path.
- If it doesn't exist, load the spreadsheet from Resources and re-save it to the persistent data path.
- Whenever you want to save or load from the spreadsheet, do so from the persistent data path.
The 'File Exists' state will only ever be true when the player loads the application for the first time. At this point it will copy the file from Resources to the persistent data path, and then you never need to use Resources again.
All the best,
Joel
-
- Posts: 14
- Joined: Thu Apr 30, 2020 10:39 pm
Re: Saving and loading a CSV spreadsheet using PlayMaker
. . . . . . it worked!
IT WORKED!!!!!
Joel, thank-you SO very much!! Your explanation with the Playmaker image of the actions laid-out was exactly what I needed.
I've been bothering you in this forum about how this all works since April 2020 and it took until just now for me to understand the whole save/load via .CSV in an Android app thing. How you tolerated me coming back over and over. . . you're a saint
Thank-you so much for your patience Joel!!
IT WORKED!!!!!
Joel, thank-you SO very much!! Your explanation with the Playmaker image of the actions laid-out was exactly what I needed.
I've been bothering you in this forum about how this all works since April 2020 and it took until just now for me to understand the whole save/load via .CSV in an Android app thing. How you tolerated me coming back over and over. . . you're a saint
Thank-you so much for your patience Joel!!
Re: Saving and loading a CSV spreadsheet using PlayMaker
Haha, glad everything is sorted for you now Let me know if you run into any other issues.TipOfTheDay wrote: ↑Mon May 22, 2023 11:54 am . . . . . . it worked!
IT WORKED!!!!!
Joel, thank-you SO very much!! Your explanation with the Playmaker image of the actions laid-out was exactly what I needed.
I've been bothering you in this forum about how this all works since April 2020 and it took until just now for me to understand the whole save/load via .CSV in an Android app thing. How you tolerated me coming back over and over. . . you're a saint
Thank-you so much for your patience Joel!!
All the best,
Joel