Saving system work on multiple scenes

Hi, I’m working on a 2D project that has multiple scenes. I was wondering if the saving system in your Udemy course works with multiple scenes? And also I’m using a different movement script for the player, Do I only need the CaptureState and RestoreState objects for saving the position or do I need the whole thing?

  1. my understanding is yes, the saving system works with multiple scenes (like in the RPG course when you move between scenes using the portals and it still saves)

  2. you can use your own movement scripts. the CaptureState and Restore state is not specific to any movement script… you just need to implement your own CaptureState and RestoreState methods, so that the various class fields of your movement script are properly recorded and restored; so you should be fine with only these implementations (and don’t need the whole thing) I think

CaptureState does use the component name as the index into the Dictionary, so different types of movers will be different types, and not saved with the same key into the Dictionary if they are different between the scenes…
That being said, it generally shouldn’t matter much if you are using a portal like system to move between scenes, as the portal will move the character where it needs to be after the transfer between scenes. When saving and restoring a specific scene (like I left the game and came back in), the correct flavor of mover will be the one in the save file, and it should work flawlessly.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms