For Multi Active/ Multi Enabled savers, if I have multiple scenes, should each saver have a unique ID?
I find some objects do NOT remember their inactive or disabled state. Also some collectibles with destructible saver do not remember their destroyed state, when going to another scene then coming back later. Why is that? I made sure they have a unique ID in this case.
Question for saver components
Re: Question for saver components
Hi,
Yes, savers should have unique IDs across the entire game. You shouldn't have a chest with an ActiveSaver in scene 1 whose ID is "chest01" and a different chest in scene 2 whose ID is also "chest01".
On the other hand, if the savers in both scenes refer to the same entity (e.g., the player), use the same ID in both scenes. For example, if the player has an InventorySaver, use the same ID so the inventory will be saved in the outgoing scene and then reapplied to the player in the new scene.
Also make sure "Save Across Scene Changes" is ticked or the savers will forget their states when changing scenes. UNticking this checkbox allows you to keep saved game sizes smaller. For example, say an arrow is flying straight toward the player's head. That arrow has a PositionSaver whose "Save Across Scene Changes" is UNticked. If you save the game while in the scene, it will save the arrow's position. This is important to prevent the player from saving and then immediately reloading to avoid the arrow. However, if the player changes to a different scene, it will not bother to take up space saving the arrow's position since presumably time has passed and the arrow has flown off or landed.
Yes, savers should have unique IDs across the entire game. You shouldn't have a chest with an ActiveSaver in scene 1 whose ID is "chest01" and a different chest in scene 2 whose ID is also "chest01".
On the other hand, if the savers in both scenes refer to the same entity (e.g., the player), use the same ID in both scenes. For example, if the player has an InventorySaver, use the same ID so the inventory will be saved in the outgoing scene and then reapplied to the player in the new scene.
Also make sure "Save Across Scene Changes" is ticked or the savers will forget their states when changing scenes. UNticking this checkbox allows you to keep saved game sizes smaller. For example, say an arrow is flying straight toward the player's head. That arrow has a PositionSaver whose "Save Across Scene Changes" is UNticked. If you save the game while in the scene, it will save the arrow's position. This is important to prevent the player from saving and then immediately reloading to avoid the arrow. However, if the player changes to a different scene, it will not bother to take up space saving the arrow's position since presumably time has passed and the arrow has flown off or landed.
Re: Question for saver components
I was able to fix objects, but not collectibles with DestroySaver, but only sometimes when I leave and re-enter a scene they are not destroyed anymore! The collectible calls SaveSystemMethods so I am sure it's saving. All the collectibles have marked "Save Across Scene Changes", I also made sure to run the "Assign Unique Keys" tool.
So what else could be causing this issue?
So what else could be causing this issue?
Re: Question for saver components
Hi,
Are other savers' states being restored, but not these collectibles?
If nothing is being restored, then it might be an issue with the save system setup.
If only the collectibles' states are not being restored, then maybe something else is reactivating them or preventing them from being deactivated.
Is the MultiActive/EnabledSaver on a GameObject that's active when the scene starts?
Can you reproduce the problem when saving and loading a game? If so, then to help get to the bottom of it temporarily change to a PlayerPrefsSavedGameDataStorer if you're currently using a different SavedGameDataStorer component. Tick the Debug checkbox. Then reproduce the issue in the editor's play mode. Examine the Console log. When you save, it will log the saved game data in a somewhat readable JSON format. Make sure your MultiActive/EnabledSaver key is in there. Then load the game and make sure it's still in the load log.
Or send a reproduction project to tony (at) pixelcrushers.com. I'll be happy to take a look.
Are other savers' states being restored, but not these collectibles?
If nothing is being restored, then it might be an issue with the save system setup.
If only the collectibles' states are not being restored, then maybe something else is reactivating them or preventing them from being deactivated.
Is the MultiActive/EnabledSaver on a GameObject that's active when the scene starts?
Can you reproduce the problem when saving and loading a game? If so, then to help get to the bottom of it temporarily change to a PlayerPrefsSavedGameDataStorer if you're currently using a different SavedGameDataStorer component. Tick the Debug checkbox. Then reproduce the issue in the editor's play mode. Examine the Console log. When you save, it will log the saved game data in a somewhat readable JSON format. Make sure your MultiActive/EnabledSaver key is in there. Then load the game and make sure it's still in the load log.
Or send a reproduction project to tony (at) pixelcrushers.com. I'll be happy to take a look.
Re: Question for saver components
I have successfully been able to replicate the issue!!
I use a DialogueTrigger on the door for level loading (1.png)
If I trigger (1.png) 2+ times before the levelload delayed statement runs... the collectibles stay active and are no longer destroyed.
I found a workaround by disabling the trigger component to prevent this, even if a player pressed interaction key multiple times.
I'm happy to find a fix, but I'm curious why does this behavior occur if you trigger levelload multiple times?
I use a DialogueTrigger on the door for level loading (1.png)
If I trigger (1.png) 2+ times before the levelload delayed statement runs... the collectibles stay active and are no longer destroyed.
I found a workaround by disabling the trigger component to prevent this, even if a player pressed interaction key multiple times.
I'm happy to find a fix, but I'm curious why does this behavior occur if you trigger levelload multiple times?
- Attachments
-
- 1.png (47.43 KiB) Viewed 528 times
Re: Question for saver components
Hi,
I think this is happening because the LoadLevel() sequencer command calls the save system's SaveSystem.LoadScene() method. This method does several things; it doesn't just load the specified scene. It tells savers that it's about to save the scene, so if GameObjects are destroyed because the level is being unloaded, they shouldn't be recorded as destroyed/inactive in the saved game data. But since it's running twice, some of that information is getting overwritten. Disabling the interaction, like you're doing, is a good way to handle it.
I think this is happening because the LoadLevel() sequencer command calls the save system's SaveSystem.LoadScene() method. This method does several things; it doesn't just load the specified scene. It tells savers that it's about to save the scene, so if GameObjects are destroyed because the level is being unloaded, they shouldn't be recorded as destroyed/inactive in the saved game data. But since it's running twice, some of that information is getting overwritten. Disabling the interaction, like you're doing, is a good way to handle it.