Loading Game

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading Game

Post by Tony Li »

Hi,

Forgive me if I asked this before, but are you saving the game at any point? In other words, do you have:
  • a script that calls PixelCrushers.SaveSystem.SaveToSlot(0)
  • or a button with a SaveSystemMethods component whose OnClick() event calls SaveSystemMethods.SaveToSlot
  • or an Auto Save Load component?
It seems like there isn't a saved game to continue from.
jrose1184
Posts: 35
Joined: Mon Jan 22, 2024 2:35 pm

Re: Loading Game

Post by jrose1184 »

Hi Sorry didnt see you replied

User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading Game

Post by Tony Li »

Hi,

Thanks for recording the videos. I think you're almost there. The final step is to save the script (ContinueButton.cs) that I provided in this post and add the script to your Continue Button. If you're saving to slot 0, you'll need to change the script to specify slot 0 instead of slot 1 (in two places).
jrose1184
Posts: 35
Joined: Mon Jan 22, 2024 2:35 pm

Re: Loading Game

Post by jrose1184 »

Hi,

So that script does not need to go into start it needs to go on the continue button and it needs to have an onclick?

Also how can i see what slot my game is saving to?
jrose1184
Posts: 35
Joined: Mon Jan 22, 2024 2:35 pm

Re: Loading Game

Post by jrose1184 »

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ContinueButton : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
var button = GetComponent<Button>();
button.interactable = PixelCrushers.SaveSystem.HasSavedGameInSlot(0);
button.onClick.AddListener(() => PixelCrushers.SaveSystem.LoadFromSlot(0));
}

// Update is called once per frame
void Update()
{

}
}

Save System: LoadFromSlot(0) but there is no saved game in this slot.

I need away to see where this game is saving to, Or is there away i can pick what block to save too?
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading Game

Post by Tony Li »

Hi,

The script should be exactly what I typed in that post, no modifications, except use the correct slot number. And it should go on the continue button.

If you're using the DemoMenu script or SaveSystemTestMenu script, they save to slot 1. (If you inspect the PlayerPrefsSavedGameDataStorer component, it shows a list of Saved Games.)
jrose1184
Posts: 35
Joined: Mon Jan 22, 2024 2:35 pm

Re: Loading Game

Post by jrose1184 »

Hi,

Made another video to explain what im seeing

User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading Game

Post by Tony Li »

Hi,

By default, the save system saves and loads a single scene, unloading any additively-loaded scenes, because it uses SceneManager.LoadScene("name", LoadSceneMode.Single).

Can you mark all of the GameObjects in your BeverageHills scene as Don't Destroy On Load? This will move them to the DontDestroyOnLoad "scene," which Unity doesn't unload when you call SceneManager.LoadScene(). You can add DontDestroyGameObject components to each of the GameObjects in the scene.
jrose1184
Posts: 35
Joined: Mon Jan 22, 2024 2:35 pm

Re: Loading Game

Post by jrose1184 »

Hi,

Thanks very much all is working now.

Just 2 more questions if you don't mind.

1)How do i remove the Main Menu from the Dialogue Manger as i built my own.

2)How do i turn off Alert Messages, If i do turn them off when i walk up to NPCs At the moment it says press space bar to interacte will turning off alarts stop that from working.

Thanks Again
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading Game

Post by Tony Li »

Hi,
jrose1184 wrote: Wed Feb 05, 2025 5:19 pm1)How do i remove the Main Menu from the Dialogue Manger as i built my own.
Remove the DemoMenu script (if that's what you're using).
jrose1184 wrote: Wed Feb 05, 2025 5:19 pm2)How do i turn off Alert Messages, If i do turn them off when i walk up to NPCs At the moment it says press space bar to interacte will turning off alarts stop that from working.
These are two different things. The "press space bar to interact" message is the selector UI. It's part of the Selector/Proximity Selector system. For info on it, including how to hide it during conversations, please see the Interaction Tutorial.

Alerts are messages that you manually show, either by using a Dialogue System Trigger with Add Action > Show Alert, or by calling the ShowAlert() Lua function in a conversation's Script field, or by calling DialogueManager.ShowAlert("message") in C#.
Post Reply