After looking around it seems there are a few ways to save but I was hoping someone could point me in the right direction for my purposes, because I've found myself overwhelmed at 2:00AM and could use some guidance.
I have a game object that asks the player (in conversation) if they want to save the game and set this point as their "save point" (respawn point.)
So is there a way for me to call this from a conversation through the sequencer? Something like this, calling Save Slot from an object with the Save System Methods component?
SendMessage(SaveSlot,,gameObject);
{{defaultsequence}}
Would there be a way to set this point as their respawn point without coding? Or should I just use the sequencer to call a method like "SavePoint = transform.position" and then player goes to "SavePoint" on deaths and loads?
And then do I just add Game Saver components to everything I want to save? Or active savers?
Basically, which tutorial would be best for me or can you point me in the right direction with a few steps and let me find my way from there.
Saving At Save Points
Re: Saving At Save Points
Hi,
The Dialogue System's save system uses slot numbers. When you save a game, you tell it to save the game under a slot number (e.g., 0, 1, 2, etc.). When you want to respawn/reload that saved game, you specify the same slot number.
1. Start by doing one of these two things:
3. Add an empty GameObject to your scene. Add a SaveSystemMethods component to it. Inspect your conversation's dialogue entry. In the OnExecute() UnityEvent section, add a scene event. Assign the empty GameObject, and configure the event to call SaveSystemMethods.SaveToSlot. Specify a slot number, such as 0.
When you want to respawn, use another SaveSystemMethods component and call SaveSystemMethods.LoadFromSlot, or in C# call PixelCrushers.SaveSystem.LoadFromSlot(0).
The Dialogue System's save system uses slot numbers. When you save a game, you tell it to save the game under a slot number (e.g., 0, 1, 2, etc.). When you want to respawn/reload that saved game, you specify the same slot number.
1. Start by doing one of these two things:
- Download and import the SaveSystemPrefabs package from the Dialogue System Extras page. Add the Save System prefab to your scene, and add the LoadingScreen scene to your project's build settings.
- Or add these components to your Dialogue Manager GameObject: SaveSystem, JsonDataSerializer, PlayerPrefsSavedGameDataStorer. Optionally add a StandardSceneTransitionManager, although you can set this up later. (The Save System prefab in the SaveSystemPrefabs package is preconfigured with these components.)
3. Add an empty GameObject to your scene. Add a SaveSystemMethods component to it. Inspect your conversation's dialogue entry. In the OnExecute() UnityEvent section, add a scene event. Assign the empty GameObject, and configure the event to call SaveSystemMethods.SaveToSlot. Specify a slot number, such as 0.
When you want to respawn, use another SaveSystemMethods component and call SaveSystemMethods.LoadFromSlot, or in C# call PixelCrushers.SaveSystem.LoadFromSlot(0).
-
- Posts: 60
- Joined: Thu Mar 24, 2022 12:07 am
Re: Saving At Save Points
Thank you! It seems to be working perfectly, the player dies and spawns at the save point.
However, now whenever I change scenes or die, the Health Bar UI goes missing from the player's Inspector. It's odd because it wasn't happening before.
Is this possibly something to do with how the Save System starts new loads? I wanted to ask before I tried to just re-find the health bar UI on every load and death, because I'm not sure that's the best way
It's not like my player is getting destroyed when he dies, and when he changes scene the new player object should automatically have the Health Bar in it like it used to. After being killed and Health Bar UI going missing: My code for dying and loading at Save Point: My code for loading new scenes with the Save System Thanks for any help.
However, now whenever I change scenes or die, the Health Bar UI goes missing from the player's Inspector. It's odd because it wasn't happening before.
Is this possibly something to do with how the Save System starts new loads? I wanted to ask before I tried to just re-find the health bar UI on every load and death, because I'm not sure that's the best way
It's not like my player is getting destroyed when he dies, and when he changes scene the new player object should automatically have the Health Bar in it like it used to. After being killed and Health Bar UI going missing: My code for dying and loading at Save Point: My code for loading new scenes with the Save System Thanks for any help.
Re: Saving At Save Points
Hi,
I'm guessing it's along the same lines as the situation described here: How To: Manage Player Controls and Scene Changes
I'm guessing it's along the same lines as the situation described here: How To: Manage Player Controls and Scene Changes
-
- Posts: 60
- Joined: Thu Mar 24, 2022 12:07 am
Re: Saving At Save Points
Nevermind, I think I got it.
I didn't know I could call the healthbar at the Start function instead of the Inspector and that seems to do the trick.
Now it seems to be working amazingly, thank you
I didn't know I could call the healthbar at the Start function instead of the Inspector and that seems to do the trick.
Now it seems to be working amazingly, thank you
Re: Saving At Save Points
Great! Glad it's working.