Saving and loading a CSV spreadsheet using PlayMaker

Examples using PlayMaker. Note that to view these examples, you will need to have purchased PlayMaker.
TipOfTheDay
Posts: 14
Joined: Thu Apr 30, 2020 10:39 pm

Re: Saving and loading a CSV spreadsheet using PlayMaker

Post by TipOfTheDay »

Hi Joel, me again :)

I'm not sure if something's happened in an update of Easy Save 3 but I'm having some trouble with it in Playmaker. Maybe it's me?

The action 'ES3 Spreadsheet Load', which I've used successfully in previous versions of ES3, seems to be universally throwing me an error now: System.ArgumentNullException: Value cannot be null.

I made sure to create a spreadsheet variable first with a Create Spreadsheet action. And I definitely have a real spreadsheet, saved as a .CSV file, saved in my Resources folder, and filled with data. But for some reason the action is throwing me this error?

I'm including a screenshot hoping it might shed some light. It shows that
1. I've got my .CSV saved in the Resources folder
2. The error message ES3 Spreadsheet Load is throwing me in the 'load SS' state
3. The .CSV file opened up showing there's all kinds of data available inside.

Any ideas why I might be hitting this null value error? Thanks again for all your help!
SS_load_issue.png
SS_load_issue.png (456.15 KiB) Viewed 10386 times
User avatar
Joel
Moodkie Staff
Posts: 4678
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving and loading a CSV spreadsheet using PlayMaker

Post by Joel »

Hi there,

Please could you send me the full error with line numbers? You may need to ensure that your error event is set to None so that this is outputted to the console.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
TipOfTheDay
Posts: 14
Joined: Thu Apr 30, 2020 10:39 pm

Re: Saving and loading a CSV spreadsheet using PlayMaker

Post by TipOfTheDay »

Hi Joel,

Thanks so much for the quick reply! Here's a screenshot from the console, I've highlighted the ES3SpreadsheetLoad line hoping that sheds some light (I hope that's what you mean by full error with line numbers? If not, pardon my ignorance, please let me know!)

I know the console also shows an error on ES3SpreadsheetGetCell but I figured that might be a result of the first issue - not being able to load the spreadsheet. So I left it out.

Thanks again for any insight or help that might shed some light on this. I'm kind of surprised because I've used these exact actions in 2-3 other games before and can't think of what I might be missing compared to those times for setup?
SS_load_issue_console.png
SS_load_issue_console.png (261.71 KiB) Viewed 10381 times
User avatar
Joel
Moodkie Staff
Posts: 4678
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving and loading a CSV spreadsheet using PlayMaker

Post by Joel »

Hi there,

The issue appears to be that it's not finding the file, but unfortunately it's not possible to tell why.

Firstly check that you've not set Cache as the default Location in Tools > Easy Save 3 > Settings. If this isn't the case, please could you replicate this in a new project with a simple scene and private message it to me with step by step instructions.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
TipOfTheDay
Posts: 14
Joined: Thu Apr 30, 2020 10:39 pm

Re: Saving and loading a CSV spreadsheet using PlayMaker

Post by TipOfTheDay »

Hi Joel,

I think you're right! Though, I went to check the default location and it was set to File not Cache. But I switched it to Resources instead and now I don't get an error about the spreadsheet being null.

Instead though, I get a new error message (which might be much easier to solve). I've attached a screenshot but it's something about not having the correct input type? I'll admit, my spreadsheet has a mix of data like text(names), integers(level numbers), and floats(NPC stats). Does all of my data have to be string format instead? I don't understand the error message well but that's the impression I'm getting?

And yes, I know this is a slightly different error now, but if sharing a test project still looks like the best way to share this error let me know again and I'll do so in my next reply (via DM to you).

Thanks again so much for your insight!
Attachments
SS_load_issue_2.png
SS_load_issue_2.png (349.36 KiB) Viewed 10378 times
User avatar
Joel
Moodkie Staff
Posts: 4678
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving and loading a CSV spreadsheet using PlayMaker

Post by Joel »

Hi there,

Being able to see a new project with a simple scene which replicates this would still be the best way to proceed.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
User avatar
Joel
Moodkie Staff
Posts: 4678
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving and loading a CSV spreadsheet using PlayMaker

Post by Joel »

If anyone encounters an issue with only being able to select one type of variable for the value of the Load or Save Cell action, this is due to a bug at PlayMaker's end. Deleting the action and re-adding it resolves the issue.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
TipOfTheDay
Posts: 14
Joined: Thu Apr 30, 2020 10:39 pm

Re: Saving and loading a CSV spreadsheet using PlayMaker

Post by TipOfTheDay »

Hi Joel, me again! :)

I'm back at this Android game and desperately trying to figure out how to save my final stats. Because this thread is title saving and loading using PlayMaker, I'm hoping adding a question about saving is fair? If not, I can start a new thread.

I'm hitting a weird logical wall when trying to save to a spreadsheet, via PlayMaker, for an Android game specifically. I've hit this wall before but I know it's me who's wrong and there MUST be a simple solution. Many, many, many Android games save their player stats so I know this shouldn't be rocket science. My goal is to save the player game stats to a spreadsheet using PlayMaker. That's all.

Here's what goes wrong:
- I use ES3 Spreadsheet Create to setup an initial ES3 variable (works)
- I then use ES3 Spreadsheet Set Cell to capture the value of a game variable (works)
- I then use ES3 Spreadsheet Save to save this ES3 variable to a .CSV file and this is the PlayMaker action that fails

The error says 'ES3SpreadsheetSave: System.NotSupportedException: Cannot write directly to Resources folder. Try writing to a directory outside of Resources, and then manually move the file there.'

As far as I know, the only folder Android games can interact with though is the Resources folder? So everything I work with needs to go there. I've been using the Load action successfully and that .CSV file is saved in the Resources folder without issue. It only seems to be once I try to load? I'm 100% certain Easy Save 3 is able to save to a .CSV file for an Android game, I'm betting hundreds or maybe thousands of other users have successfully saved something in their Android games with this asset so I'm hoping you can help me understand why I'm getting this error and how to work around it?

Thanks so much Joel!
Attachments
ES3 save issue with Resources folder
ES3 save issue with Resources folder
ES3_save_issue.jpg (105.32 KiB) Viewed 3462 times
User avatar
Joel
Moodkie Staff
Posts: 4678
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving and loading a CSV spreadsheet using PlayMaker

Post by Joel »

Hi again :)
As far as I know, the only folder Android games can interact with though is the Resources folder?
The only folder you can save to on Android is Application.persistentDataPath, which Easy Save uses when the location is set to File (which it is by default). Resources can't be saved to at runtime on any platform as it's compiled at build time.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
TipOfTheDay
Posts: 14
Joined: Thu Apr 30, 2020 10:39 pm

Re: Saving and loading a CSV spreadsheet using PlayMaker

Post by TipOfTheDay »

Thanks for such a quick reply Joel! I really appreciate your help.

I've read over your response and believe I understand what you're recommending. I'm still stuck though and I wonder if I might have stumbled on another issue with Playmaker instead? I get the feeling Playmaker isn't properly packing/"connecting" the Persistent Data Path upon building for Android perhaps? Using 'File' as the Persistent Data Path in Unity works exactly as expected. But when I then do to build for Android, it just. . . doesn't work. It will not load from that Persistent Data Path.

Here's what's happening:

Instead of loading from a 'Resources' folder within my Assets folder (and getting the save-failure when I try to save to the same location), I've switched the Runtime Settings in EasySave3 to File now like you recommend. Within Unity, it works perfectly. I can store .CSV files in that Persistent Data Path folder and load/save from that folder without any issue. . .

Until I build to Android and try to run the app. Suddenly it's as if Android just will not load from the Persistent Data Path and instead those values all load either blank, or with odd error text. When I jump back into Unity and hit play, everything is perfect though?

I have a small demo app I could share with you? It's stripped down to just trying to load a few variables via 'File' as the Persistent data path. It highlights the issue really well I believe. In Unity, the .CSV data loads perfectly from the Persistent Data Path, but in the .APK build on Android, it just won't load for some reason?

Unless there are some settings in the build player I should adjust too?
Post Reply