Save Scale
-
- Posts: 44
- Joined: Sun Feb 20, 2022 5:53 pm
Re: Save Scale
Ill have to make a spreadsheet and figure out what needs saved across scenes. For me it will be this scale saver and some items. Thank you for explaining this!
-
- Posts: 44
- Joined: Sun Feb 20, 2022 5:53 pm
Re: Save Scale
Quick question, So lets say Scene 1 has Potions that need to be active state saved. I have created a MultiActiveSaver and have quite a few objects on it. It is attached to the player avatar so that as the character advances to scene 2 other items are saved for scene 2. BUT these potions are not in scene 2, will this cause an issue?
Re: Save Scale
Yes. Use separate MultiActiveSavers in each scene. So scene 1's MultiActiveSaver saves the active states of the potions in scene 1, and scene 2's MultiActiveSaver saves the active states of the potions in scene 2.
-
- Posts: 44
- Joined: Sun Feb 20, 2022 5:53 pm
Re: Save Scale
So Im using the UCC Saver and it is stored on the parent object of the player character. When the player goes from scene 1 to scene 2 and a save is done the player still starts back in scene 1. I am doing a ASync load and moving the parent object and the player character to scene 2. How can I make the player start in scene 2 when they save in scene 2?
Re: Save Scale
Hi,
1. Use a different player GameObject in each scene. (This isn't absolutely required, but it makes it easier to test scenes individually.)
2. Change scenes using PixelCrushers.SaveSystem.LoadScene() in C#, or use a ScenePortal component/prefab, or add a SaveSystemMethods component to some GameObject and configure a UnityEvent to call SaveSystemMethods.LoadScene.
Note that you can specify a spawnpoint by name in the destination scene. The Save System will look for a GameObject with that name and move the player there.
1. Use a different player GameObject in each scene. (This isn't absolutely required, but it makes it easier to test scenes individually.)
2. Change scenes using PixelCrushers.SaveSystem.LoadScene() in C#, or use a ScenePortal component/prefab, or add a SaveSystemMethods component to some GameObject and configure a UnityEvent to call SaveSystemMethods.LoadScene.
Note that you can specify a spawnpoint by name in the destination scene. The Save System will look for a GameObject with that name and move the player there.
-
- Posts: 44
- Joined: Sun Feb 20, 2022 5:53 pm
Re: Save Scale
Between my scenes 1 and 2 I cant make a seperate game object, just too many variables and game objects in that tree that is required for my game.
Im using a scene transition asset for changing scenes that I really like so I guess Im going to try the save system methods component. I have attached that to the player character, do I need to put in a default starting scene name? I will just change my code in the load/continue button in menu to load. I guess my question is SaveSystemMethods will save the scene the character is in? Thanks Tony!
Im using a scene transition asset for changing scenes that I really like so I guess Im going to try the save system methods component. I have attached that to the player character, do I need to put in a default starting scene name? I will just change my code in the load/continue button in menu to load. I guess my question is SaveSystemMethods will save the scene the character is in? Thanks Tony!
Re: Save Scale
To change scenes using a different scene-changing asset, see the instructions in: How To: Change Scenes With Save System
-
- Posts: 44
- Joined: Sun Feb 20, 2022 5:53 pm
Re: Save Scale
Perfect! Thank you! Ill do some more reading and get this implemented.
-
- Posts: 44
- Joined: Sun Feb 20, 2022 5:53 pm
Re: Save Scale
Ok lets say I have added the correct code for saving. *Might need some more tweeking. I have a game menu and a Load Game function. Also lets say scenes 1 2 and 3. The player exits at scene 2 and that saves the game to slot 0. My code looks like
public void LoadGame()
{
SaveSystem.LoadFromSlot(0);
PixelCrushers.SaveSystem.ApplySavedGameData();
//SaveSystem.LoadScene("scene");
}
So if I use the savesystem.loadscene how does it know which of the 3 scenes to load from?
public void LoadGame()
{
SaveSystem.LoadFromSlot(0);
PixelCrushers.SaveSystem.ApplySavedGameData();
//SaveSystem.LoadScene("scene");
}
So if I use the savesystem.loadscene how does it know which of the 3 scenes to load from?
Re: Save Scale
Hi,
Keep the Save System component's Save Current Scene checkbox ticked.
To save your game, just use:
To load your game, just use:
If you were to use the Save System's scene changer, you'd use a Scene Portal or this code:
However, since you're using something else to change scenes, run this code before changing the scene:
Then change the scene. After changing the scene, run this code:
Keep the Save System component's Save Current Scene checkbox ticked.
To save your game, just use:
Code: Select all
PixelCrushers.SaveSystem.SaveToSlot(0);
Code: Select all
PixelCrushers.SaveSystem.LoadFromSlot(0);
Code: Select all
PixelCrushers.SaveSystem.LoadScene("scene-name");
Code: Select all
PixelCrushers.SaveSystem.RecordSavedGameData();
PixelCrushers.SaveSystem.BeforeSceneChange();
Code: Select all
PixelCrushers.SaveSystem.ApplySavedGameData();