Scene State Slot Recommendations

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
pargee
Posts: 5
Joined: Wed Apr 12, 2017 9:21 pm

Scene State Slot Recommendations

Post by pargee »

Hey guys,

First off, thanks for all your hard work on this! It's a fantastic product and I'm sure has saved many countless hours.

I'm working on a project where I'll need to save the current state of the scene to a designated save slot (let's say Slot A, B, C). Users are able to move through the environment placing various prefabs, then save over the desired slot. The AutoSave feature seems to be largely working for this when disabling the automatic saving/loading options, with the only issue being cleanup of existing objects when loading a given slot.

What I'm trying to achieve is to load a snapshot of the scene and all it's objects that were added. In a perfect world, we would not need to reload the base 'empty' scene prior to loading, but simply clean up the objects that were added in since the user last clicked load.

Desired UX:
User goes through environment, instantiating objects.
User saves scene state by clicking Save Slot A
User adds X more objects to scene, determines they do not like the changes, clicks Load Slot A
Scene reverts to previous Slot A state without the need to reload the map first.

Alternate -
User clicks Load Slot A, observes object placement in scene state
User clicks Load Slot B, observes object placement in scene state

Is there any way to handle the above scenario without A) finding all 'placed' objects and removing them, THEN loading the save slot -or- B) reloading the scene, then loading the save slot.

Apologies if this seems confusing!

Cheers,
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Scene State Slot Recommendations

Post by Joel »

Hi there,

I believe the "Delete Instantiated Prefabs on Load" option in the Auto Save settings may be what you're after. This essentially deletes all of the prefabs previously instantiated by Auto Save before loading any new data.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
pargee
Posts: 5
Joined: Wed Apr 12, 2017 9:21 pm

Re: Scene State Slot Recommendations

Post by pargee »

Thanks Joel!
This sounds like it will work, I'll just have to play with things more -- I noticed after launching today my instantiated prefabs were launching without materials being saved. I needed to re-activate them as autosave items for it to work, but I'm not sure why I'm experiencing this now vs yesterday.

Just so I'm clear, does marking a prefab with Save at the top level indicate that you want all modified values to be autosaved? (screenshot attached)
https://ibb.co/iG14mQ

Furthermore, I've been unable to successfully build because random components are returning the following:
Assets/Easy Save 2/Types/ES2UserType_UnityEngineEventSystemsEventSystem.cs(15,19): error CS1061: Type `UnityEngine.EventSystems.EventSystem' does not contain a definition for `runInEditMode' and no extension method `runInEditMode' of type `UnityEngine.EventSystems.EventSystem' could be found. Are you missing an assembly reference?
Thanks again for all the help, and any thoughts on the above two issues is greatly appreciated!

Cheers,
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Scene State Slot Recommendations

Post by Joel »

Hi there,

When saving a GameObject or Prefab at the top level in Auto Save, it first checks if each of the Components is a supported type (i.e. the type is natively supported, or support has been added in Manage Types). If the Component is not a supported type, it will attempt to automatically add support for that Component.

Auto Save will automatically save public fields, and properties and private fields marked with the [System.Serializable] attribute. However, in your case the material property is not automatically serialised because it is not marked as serialisable by Unity. In your case you will want to select the individual Components and variables
you want to save rather than the entire GameObject. Unless you're changing the Material at runtime, you can leave your MeshRenderer Component unselected.

With regards to the runInEditMode bug you're encountering, this appears to happen because Unity marks the variable as serialisable, but it doesn't exist at runtime. We're hoping to get a workaround included in the next update for the beta, but in the meantime you should be able to remove the errors by deleting the lines which are causing the errors (double-cliking the error in the console should automatically open MonoDevelop and highlight that line so you can delete it).

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
pargee
Posts: 5
Joined: Wed Apr 12, 2017 9:21 pm

Re: Scene State Slot Recommendations

Post by pargee »

Hey Joel,

Thanks so much for the help.

Unfortunately, this does not help in scenarios for testing and building the game. Removing the runInEditMode declarations causes issues with saving when in the editor? Will update this thread if I find out more but any insights you can share are greatly appreciated.
pargee
Posts: 5
Joined: Wed Apr 12, 2017 9:21 pm

Re: Scene State Slot Recommendations

Post by pargee »

It looks like the other issue is still persisting as well with this. Everything was working perfectly fine yesterday with no changes made and today none of the objects that are being saved/loaded or will render. I can see them in the hierarchy but no mesh renderers/children are being displayed.

Are these just issues encountered with auto save? I'll start working on moving my assets over to a manual saving/loading system, but I'd hope this is an autosave issue instead of an easy save one or a lot of time will be lost.

Reproducing:
Launch scene
Place object in scene.
Save / exit
Launch scene
Object visual is not there but nodes are present in hierachy / object will not render.
Save / exit
Launch scene
Object is no longer present in scene at all.

Thanks
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Scene State Slot Recommendations

Post by Joel »

Hi there,

Would you be able to let me know the errors you're getting after removing runInEditMode?

With regards to the other issue you are having, it sounds very much like an issue which was fixed in the previous version. Firstly if you haven't done so already, please could you try updating from the Asset Store? If this makes no difference, please could you send me a test project so I can try to replicate the error at my end? The easiest way to do this is to put it into a compressed zip, upload it to something like Dropbox or WeTransfer and PM me the link.

There are currently no reported bugs with Easy Save's API, so creating a manual save/load system should work fine. Auto Save is in beta so unfortunately bugs are to be expected at this point.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
pargee
Posts: 5
Joined: Wed Apr 12, 2017 9:21 pm

Re: Scene State Slot Recommendations

Post by pargee »

Hey Joel,

Thanks so much for the reply. At the end of the day I shouldn't have rushed into AutoSave knowing it was beta. After taking the time to fully understand EasySave's manual system (and building off your object management prefabs), I've been able to put everything together in working order :)

Thanks again for all your hard work on this project and the helpful replies.

Cheers,
Justin
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Scene State Slot Recommendations

Post by Joel »

Glad you managed to find a solution Justin!

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Locked