Page 1 of 2

[SOLVED]Loading from other Scenes

Posted: Sat Nov 23, 2019 7:58 am
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?

Re: Loading from other Scenes

Posted: Sun Nov 24, 2019 6:41 pm
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

Re: Loading from other Scenes

Posted: Mon Nov 25, 2019 9:40 am
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

Re: Loading from other Scenes

Posted: Tue Nov 26, 2019 8:00 am
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

Re: Loading from other Scenes

Posted: Tue Nov 26, 2019 2:19 pm
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.

Re: Loading from other Scenes

Posted: Tue Nov 26, 2019 7:06 pm
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

Re: Loading from other Scenes

Posted: Wed Nov 27, 2019 1:35 am
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?

Re: Loading from other Scenes

Posted: Wed Nov 27, 2019 1:41 am
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

Re: Loading from other Scenes

Posted: Wed Nov 27, 2019 6:48 pm
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

Re: [SOLVED]Loading from other Scenes

Posted: Fri Nov 29, 2019 12:05 am
by AxelG
Everything works fine, when used correctly :) The asset is really simple to use!

Best,
Axel