[SOLVED] Saver Type Question

Announcements, support questions, and discussion for the Dialogue System.
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

[SOLVED] Saver Type Question

Post by KingCeryn »

Hey again, so I dont have a super big issue, but more of a question for what type of saver i should be trying to use/write-

Basically I have a custom system that uses a "Save Slot Manager" component that goes on a canvas in the Dialogue Manager Hierachy, that basically lets me "add new Save Slot" buttons, with the time and date for each save, etc.
It all works properly, saves quests, inventory, etc-

But the problem is when i quit the game, in build or editor, and start again, those slots aren't saved. The actual SAVEs are being recorded, according to the SaveSystem component, but the buttons arent saved when quitting, which basically just means i cant access those saves after quitting the game. I'd like to basically just save those buttons once theyre instantiated, so i can use like a Main Menu scene to load saves from those buttons i instantiate, and I'm having some trouble figuring out which Saver Component to use.

Would it be a good idea to use the Spawned Object Manager? Ive tried using that but it doesnt seem to be saving them when theyre instantiated, despite being in the list of spawnable prefabs.
I'd like the player to be able to quit from any scene and still be able to start the game up and get those Save Slot Buttons no matter what, as long as theyve been instantiated and the Saves are still recorded in the system.
Last edited by KingCeryn on Mon Jan 31, 2022 11:32 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 22152
Joined: Thu Jul 18, 2013 1:27 pm

Re: Saver Type Question

Post by Tony Li »

A saver script by itself can't be the solution here because saver scripts are only used when saving or after a game has been loaded. However, you can use a saver script to save the time & date and other info about a save.

For more info on this, see How To: Include Summary Info In Saved Games.
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Re: Saver Type Question

Post by KingCeryn »

Ah, gotcha! I think I can make that work.

What would be the best way to check if a save exists when the game starts, for instance. In order to make sure the Save Slot buttons are instantiated when the game restarts, for instance in a main menu or a "you are dead" menu, similiar to Witcher 3 or Cyberpunk in these screenshots.

Would I maybe check the SaveSystem component on the DialogueManager and do some kind of foreach for any save slots that "HaveData," and instantiate a button prefab that has the time and date info, etc?

EDIT: oh i see now in the link you shared talks a bit about that, would that approach do what im describing?
Attachments
Save Slots screen.jpg
Save Slots screen.jpg (162.6 KiB) Viewed 813 times
2752296-screen shot 2015-05-25 at 2.51.19 pm.jpg
2752296-screen shot 2015-05-25 at 2.51.19 pm.jpg (40.21 KiB) Viewed 813 times
User avatar
Tony Li
Posts: 22152
Joined: Thu Jul 18, 2013 1:27 pm

Re: Saver Type Question

Post by Tony Li »

Yes, loop through the possible save slots and check SaveSystem.HasSavedGameInSlot(#).
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Re: Saver Type Question

Post by KingCeryn »

Thanks so much, Ill try all this!
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Re: Saver Type Question

Post by KingCeryn »

Hey thanks again, that all works perfectly now!
Im able to load in slots/buttons that correspond to the saves i have in the system now, but i am getting a strange bug that I can't pin down- If i load a save that was made in the same scene im currently in, after it loads the timescale gets stuck at 0.

It only happens if its the same scene, so if i load a save from the main menu > Scene A, it works fine. same with Scene A > Scene B, and vice versa, but if its Scene A > Scene A, after the scene finishes loading, the timescale is frozen at 0. Anything that might be doing this?

I am using a Scene Transition Manager to use a loading scene in between, but the "Pause During Transition" is unticked.
User avatar
Tony Li
Posts: 22152
Joined: Thu Jul 18, 2013 1:27 pm

Re: Saver Type Question

Post by Tony Li »

Hi,

Does your menu set Time.timeScale to zero? If so, you may need to configure it to unpause time when loading a saved game.
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Re: Saver Type Question

Post by KingCeryn »

Nope, nothing i can find in my menu does that, but ill keep looking around if nothing in the Dialogue Manager has that function. thanks!
User avatar
Tony Li
Posts: 22152
Joined: Thu Jul 18, 2013 1:27 pm

Re: Saver Type Question

Post by Tony Li »

If you select menu item Edit > Project Settings > Time, you can keep an eye on the Time Scale value in Project Settings to see when it goes to zero.

There are some things in the Dialogue System that can pause time:
  • Dialogue System Trigger > Start Conversation: If you've ticked 'Pause During Conversation'
  • If you're using a PauseGameOnConversation component (deprecated)
  • Quest Log Window: If you've ticked 'Pause While Open'
  • The DemoMenu and SaveSystemTestMenu if you've ticked the option to pause when open
  • If you've set Dialogue Time to Gameplay (its default value is Realtime) and call DialogueManager.Pause() or pause DialogueTime
If you can't pinpoint the issue, feel free to send a reproduction project to tony (at) pixelcrushers.com with reproduction steps.
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Re: Saver Type Question

Post by KingCeryn »

SMH ah im so stupid! I forgot that my Invector Inventory DOES set the timescale to 0, and when changing scenes it replaces the player's inventory, so if i save from the inventory menu instead of the regular menu, it doesnt reset the timescale.

Thanks for all the help!
Post Reply