Page 1 of 1

Issue when reloading scene

Posted: Wed Dec 28, 2022 3:11 am
by lvladimirov
Hello there,
Let me start off by saying the asset is pretty great and saves a ton of time. Now the issue I currently have is with reloading scenes and then loading from the save. Maybe that is not entirely true as I guess the exact problem is the order of execution .LoadScene will load in the next frame, so even tho im loading the save file after I call LoadScene, the data from the file is read and applied and then the scene gets reloaded the next frame and overwrites everything, making it look like the load form the file did not work. That is my current theory, but i couldnt manage to solve it by using an Invoke("loadFromES3", 1.0f); after the .LoadScene, so I could be wrong. Any ideas of what the issue might be and how would be the proper way to reset the scene and load values from the es3 file?
Thanks!

Re: Issue when reloading scene

Posted: Wed Dec 28, 2022 8:53 am
by Joel
Hi there, and thanks for getting in contact.

You should load the data in the scene that you’re loading (for example in an Awake method in that scene), rather than in the scene that you’re calling LoadScene from.

All the best,
Joel

Re: Issue when reloading scene

Posted: Thu Dec 29, 2022 8:57 am
by lvladimirov
Thanks for the answer, It makes sense and I tried it like that initially (only not in awake, but in start, as loading is triggered by an event, to which the listeners subscribe on enable). Anyway, after more testing I think that the save system itself seems to work fine ot its own, I only have issues if I use SceneManager.LoadScene(scene.name); as well, however it seems it no longer belongs in this forum as its not a problem with ES3 :D
Thanks for the help!