[SOLVED]Loading from other Scenes

Discussion and help for Easy Save 3
AxelG
Posts: 8
Joined: Wed Nov 20, 2019 6:40 pm

[SOLVED]Loading from other Scenes

Post by AxelG »

Hello,

While testing my PlayMaker project save/ load system, I’m facing a problem I don’t understand.
When testing in the same Scene everything works, but when testing from an other Scene,
the value that should be loaded (strings, int and game objects) are empty (the result loaded is blank).

Does somebody have any idea what’s going on?
Last edited by AxelG on Fri Nov 29, 2019 12:04 am, edited 1 time in total.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Loading from other Scenes

Post by Joel »

Hi there,

This usually means that saving depends on there being references which don't exist in the scene you're loading in. Please could you tell me more about how you're saving and loading? Are any exceptions throw?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
AxelG
Posts: 8
Joined: Wed Nov 20, 2019 6:40 pm

Re: Loading from other Scenes

Post by AxelG »

Hi Joel,

For that example I'm saving strings, arrays and GameObjects in a scene "B" and I want to load
a particular string and an array in a scene "A".

That is weird for the references, since I does work in the scene "B".
Is there a way I can find the savefile created and check for its content outside Unity?

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

Re: Loading from other Scenes

Post by Joel »

Hi Axel,

Loading a GameObject in a scene in which it doesn't exist will not work because the required references won't be in that scene. However, if your GameObject is a prefab which is instantiated at runtime, you can follow the Saving and Loading Prefab Instances instructions here and it will be possible for the references to be resolved: https://docs.unity3d.com/ScriptReferenc ... aPath.html . You will also need to paste the Easy Save 3 Manager from Scene B to Scene A to ensure the reference manager has the required references.

With regards to strings, these should work fine as they are value types. Please could you show me some screenshots of your Save and Load actions?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
AxelG
Posts: 8
Joined: Wed Nov 20, 2019 6:40 pm

Re: Loading from other Scenes

Post by AxelG »

Okay for the gameobject, though I'm doing it after the scene load, I didn't have any issues while testing just that.
I'll try with prefabs if I have any issues.

For the string here are the screenshots (please enlarge the image, can't get "rimg" to work):

Load from Scene "A"

Image

Image


Save from Scene "B"

Image

To test the loading I go first on the Scene "B" then load the Scene "A" and try to reload "Scene B" from the Load action I made.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Loading from other Scenes

Post by Joel »

Hi there,

I see that you don't have any error events or default values set up.

Please could you specify the default values for the Load actions, and error events (found in the Error Handling foldout) for all of the actions and see if any errors are occurring, or whether the Load actions are returning the default value (which indicates that it cannot find the data you're trying to load).

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
AxelG
Posts: 8
Joined: Wed Nov 20, 2019 6:40 pm

Re: Loading from other Scenes

Post by AxelG »

Hey Joel,
I set default values and error events and it didn't help. Except telling me that it isn't loading Scene B from Scene A, there is no change.

What I understand is that Scene A can't load Scene B because it doesn't have its name, the string global variable CurrentEpisodeName.
What I don't understand is why, since I save it on save file, it seems that there is a problem with loading this value on Scene A.

Here are some screeshots while testing directly within Unity.

The process is,

I start on Scene A, load Scene B with a button "Start" where Scene B's name is directly written.
https://i.imgur.com/xpt2gqp.jpg

As you can see, the CurrentEpisodeName value is stored in all modules

Here I tried a Load action to see if the value was correctly stored.

https://i.imgur.com/aoHSjne.jpg


After Scene B is loaded, it wait for few seconds, then load back Scene "A", still directly written in the module, this action is for test purposes.

Scene A is loaded, but as you can see, CurrentEpisodeName value is now gone.
https://i.imgur.com/KkhgGjD.jpg

That's what I can't understand, why can't this value be loaded anymore?
AxelG
Posts: 8
Joined: Wed Nov 20, 2019 6:40 pm

Re: Loading from other Scenes

Post by AxelG »

Okay my bad, it was the "set string value". I put it to test the value u__u' But it was cancelling the saved one...

Thank you for your time Joel.

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

Re: Loading from other Scenes

Post by Joel »

Glad you managed to find the solution to your issue, let me know if you run into any other issues :)

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
AxelG
Posts: 8
Joined: Wed Nov 20, 2019 6:40 pm

Re: [SOLVED]Loading from other Scenes

Post by AxelG »

Everything works fine, when used correctly :) The asset is really simple to use!

Best,
Axel
Post Reply