save location not working

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
frostamation
Posts: 12
Joined: Mon Jan 19, 2015 11:39 pm

save location not working

Post by frostamation »

Im new to using easysave, still trying to get everything figured out. After a few hours of trial and error I still can not seem to save an int to a file. I have the "easy save default settings" prefab in my scene with C:/Users/User/Saves/ set as the default save location. When i try to save the data i get an error in unity of "UnauthorizedAccessException: Access to the path "C:\Users\User" is denied."

Now all im trying to do is create a simple save, in any location really, but after reading the documentation and google i still can not figure it out. any help appreciated, thanks!
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: save location not working

Post by Joel »

Hi there,

We strongly advise that you only save to the default save path (i.e. only specify a filename) as this is the only place which is guaranteed to exist and have the correct security privileges. You can output the location of this path to console using this line of code:
Debug.Log(Application.persistentDataPath);
If you need to save to an absolute path, the error you're getting denotes that you don't have security privileges for where you want to save, or that location doesn't exist, or can not be created. If you're literally using the path C:/Users/User/Saves/ and you're not replacing the User part with a particular username, then this is probably your problem.

Hope this helps!

All the best,
Joel
frostamation
Posts: 12
Joined: Mon Jan 19, 2015 11:39 pm

Re: save location not working

Post by frostamation »

So in the "default PC data path:" i should leave this box blank/type in only xyz.txt? If so where would this save the .txt file at, im using playmaker so i cant type in the debug line because playmaker only has the regular debug.log action.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: save location not working

Post by Joel »

You should leave the 'Default PC data path' entirely blank, and only specify a filename when saving/loading. For example, this code:
ES2.Save(123, "myFile.txt?tag=myTag");
Will save a tag called myTag with a value of 123 to a file named myFile.txt in the default save path.

The default save path differs between users and platforms, but usually on Windows 7 it's:
C:/Users/YourUsername/AppData/LocalLow/CompanyName/GameName/
All the best,
Joel
frostamation
Posts: 12
Joined: Mon Jan 19, 2015 11:39 pm

Re: save location not working

Post by frostamation »

Found it, but it seems to be encrypted even though im not checking the box for encryption.

heres whats in the txt file,

~ player_V3 ÿFÜfì {~Player_Muzzle_V3 ÿFÜfì8%³CÏD*Cêü³C{~Coin location V3 ÿFÜfì {~Current health ÿîñéý70{~Current Game Currency ÿîñéý0{~Save_Health
ÿV¨âF {

Now i say this because when i go to load the values back it does not load them and i get no errors or warnings in the console, so im trying to figure out what is happening when i press the load button in game.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: save location not working

Post by Joel »

Easy Save saves data in a binary format (as this is significantly faster than any other format), so the data there is not encrypted, it's just not displayable in your text editor. Easy Save files aren't intended to be edited manually, and should only be modified using Easy Save 2 or Easy Save 2's File Editor.

Could I see the code you're using to see where you're going wrong? Are you assigning the loaded data back to your variables? It's not possible to do this automatically in Unity, so you must assign the data back to the variable which you saved (see our Guides for more info).
frostamation
Posts: 12
Joined: Mon Jan 19, 2015 11:39 pm

Re: save location not working

Post by frostamation »

right now i just have it setup in playmaker as

player presses "k" keyboard button(in state 1), saveall global variables (state 2)
player presses "L" keyboard button(in state 1), loadall global variables (state 3)

the saveall / loadall is from the easysave2 actions inside playmaker. the saveall seems to be working i think, the easysave2 file editor isnt showing up under my assests/easysave2/ so i cant check inside there to see if the values change.

but thats all thats in the FSM at the moment just those 3 things.
frostamation
Posts: 12
Joined: Mon Jan 19, 2015 11:39 pm

Re: save location not working

Post by frostamation »

update: I was using the saveall / loadall option inside playmaker actions for saving the globals.

I just tried using the save int / load int on just one global var that was an int and it worked. Now i dont know if thats because it had a tag? since i had to give it a tag(which i just made the tag name the same name as the global var).

Does this mean saveall loadall isnt working correctly or am i finding some sort of bug?
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: save location not working

Post by Joel »

If the File Editor isn't appearing under the Assets > Easy Save 2 menu, it may be that the Asset Store imported Easy Save incorrectly, so it would firstly be worth reinstalling it.

To do this, delete the Assets/Easy Save 2/ and Assets/Plugins/Easy Save 2/ folders, and then reinstall from the Asset Store. You'll then want to go to the Assets menu and select Easy Save 2 > Install or Update Playmaker Actions to update the Playmaker action.

If that doesn't fix your problem, please could you send me some screenshots of your actions and variable lists so I can try to replicate the error at my end?

Also note that Save All can only save types which are on the Supported Types list.

All the best,
Joel
frostamation
Posts: 12
Joined: Mon Jan 19, 2015 11:39 pm

Re: save location not working

Post by frostamation »

Uninstall/reinstall worked and now i can see the file editor, ill try the saveall/loadall actions again and see if it works, if not its not a huge deal just a little more time to save each var inside playmaker globals. I'll update once i have time to try those out again, thanks for the help!
Locked