Resources & Default Save Location Issue

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
Dak_796
Posts: 8
Joined: Sat Apr 15, 2017 6:08 pm

Resources & Default Save Location Issue

Post by Dak_796 »

I am using the editor to save out levels to the resources folder (just as an "offline" tool).

This is an offline workflow during a single "play" of the app to build, export and then test levels by loading them back in:
1. Export the level to the Resources folder. This works fine as long as I have the Default Save Location set to "File" in the Settings/General tab.
2. Refresh the Asset Database.
3. Switch the Default Save Location to "Resources" and then load the level.

Switching the Default Save Locaiton during a play session doesn't seem to work- I have tried executing:

Code: Select all

// Load from Resources using ES2Settings
ES2Settings settings = new ES2Settings();
settings.saveLocation = ES2Settings.SaveLocation.Resources;
And also setting the property on a Easy Save Default Settings game obj. But nothing seems to override the setting in the ES2 Settings/General window.
I am using Playmaker if that is a factor.
Any ideas what is wrong? Or is this just not a workflow that is possible.
Thanks!

BTW ES2 is awesome- file sizes are incredibly small and it is super easy to use. I wasted way too much time coming up with my own serializer.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Resources & Default Save Location Issue

Post by Joel »

Hi there,

Thanks for the praise, much appreciated :)

Hopefully I can help clarify a few things. If you're creating an ES2Settings object to specify which setting to use, this settings object needs to be provided as a parameter to the Save/Load methods (which won't be possible using Playmaker).

With regards to the Default Settings Object, these default settings are only applied when the scene first loads, so modifying the script at runtime will not modify the default settings.

If you wish to change the default settings at runtime, you need to modify the static fields in the ES2GlobalSettings class. In your case, the ES2GlobalSettings._defaultSaveLocation variable. I don't believe you can do this in Playmaker, but it's very simple to do in a script:
public void ChangeDefaultSaveLocation(ES2Settings.SaveLocation location)
{
    // Make sure ES2 has been initialised so our default location doesn't get overwritten.
    ES2.Init();
    ES2GlobalSettings._defaultSaveLocation = location;
}
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Dak_796
Posts: 8
Joined: Sat Apr 15, 2017 6:08 pm

Re: Resources & Default Save Location Issue

Post by Dak_796 »

Thanks Joel,
I wrapped it in a playmaker action so I can change that setting within my FSMs.
Works perfectly now!
Thanks a ton!
Locked