Hello,
I'm using a combination of Dialogue system, Playmaker, Ultimate Inventory System and Easy Save 3.
The save system has been setup to use Dialogue system saver instead of UIS as detailed in documentation.
In my first scene, the save button will start a Playmaker FSM state that has Dialogue System's Save Game action. It store result into a string variable called saveSlot.
After that, the next FSM action us Easy Save's Save All action to store the saveSlot and other FSM variables into a file.
When loading, I first start a Easy Save's Load All action to load all variables and then start Dialogue System's Load Game action to complete the loading.
The above process works fine when used in the first scene. But once player move into another scene with the same setup and make a save or do a load, I got a "NullReferenceException: Object reference not set to an instance of an object"
This error occurred during the Load All action state.
At this point, I have no idea what's happening.
I apologize if this sounds so confusing because I was also pretty confused trying to make the save system work across these 3 integrations.
Cannot load data between different scenes
-
- Posts: 6
- Joined: Thu Apr 25, 2024 12:24 pm
Cannot load data between different scenes
- Attachments
-
- Screenshot_10.png (24.07 KiB) Viewed 345 times
Re: Cannot load data between different scenes
Hi,
Have you assigned any references in the inspector between the Dialogue Manager GameObject's hierarchy and GameObjects or FSMs outside of the Dialogue Manager GameObject's hierarchy?
If so, please see How To: Manage Player Controls and Scene Changes for a discussion of what's probably happening and some tips on how to resolve it. The context of that article is player controls and scene changes, but the same ideas apply to any type of scene change, including loading a saved game. (Loading a saved game closes the current scene and loads a new scene, even if that new scene is a fresh instance of the very same scene.)
Have you assigned any references in the inspector between the Dialogue Manager GameObject's hierarchy and GameObjects or FSMs outside of the Dialogue Manager GameObject's hierarchy?
If so, please see How To: Manage Player Controls and Scene Changes for a discussion of what's probably happening and some tips on how to resolve it. The context of that article is player controls and scene changes, but the same ideas apply to any type of scene change, including loading a saved game. (Loading a saved game closes the current scene and loads a new scene, even if that new scene is a fresh instance of the very same scene.)
-
- Posts: 6
- Joined: Thu Apr 25, 2024 12:24 pm
Re: Cannot load data between different scenes
Hi,
I double checked the scene and the Dialogue Manager GameObject and there isn't any reference to any GameObject outside of itself. There's one event FSM on Dialogue Manager GameObject that points to itself though.
But today, I replaced the Easy Save's Save All and Load All actions with Easy Save's Save Multiple and Load Multiple to control what variables it actually saved. And then it just works.
In Easy Save's documentation, it might be that the Load All action load all references in the scene including those that doesn't exist in another scene so it will throw error if the Load All action is triggered in a different scene than the one it was originally saved to. At least, that's my understanding so I decided to save variables individually despite it taking some time.
Also because I gave up trying to find which reference should exist and which should not.
I double checked the scene and the Dialogue Manager GameObject and there isn't any reference to any GameObject outside of itself. There's one event FSM on Dialogue Manager GameObject that points to itself though.
But today, I replaced the Easy Save's Save All and Load All actions with Easy Save's Save Multiple and Load Multiple to control what variables it actually saved. And then it just works.
In Easy Save's documentation, it might be that the Load All action load all references in the scene including those that doesn't exist in another scene so it will throw error if the Load All action is triggered in a different scene than the one it was originally saved to. At least, that's my understanding so I decided to save variables individually despite it taking some time.
Also because I gave up trying to find which reference should exist and which should not.
Re: Cannot load data between different scenes
Good catch!