Calling the scene from my saved file

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
baxta86
Posts: 17
Joined: Wed Jun 30, 2021 7:53 am

Calling the scene from my saved file

Post by baxta86 »

Hi Tony,

Wondering how i can call the scene which is in my saved file? Looking through the docs, I found this under SavedGameData: String PixelCrushers.SavedGameData.sceneName

How can I go about calling it, or assign it to a variable, if I were loading a scene in a custom script? As in, something like:
Application.LoadLevel(PixelCrushers.SavedGameData.sceneName)

I'm still learning coding, and when i try this code, i need to add an object reference - but not sure how to reference my save file as opposed to creating a new reference of SavedGameData?

If it's not too much trouble, it would be good to know how to access other data in the save file as well (values from the keys)

Hope that's clear....
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Calling the scene from my saved file

Post by Tony Li »

Hi,

Get the saved game data and access its sceneName field:

Code: Select all

SavedGameData savedGameData = SaveSystem.storer.RetrieveSavedGameData(slotNumber);
Debug.Log("Game was saved in scene: " + savedGameData.sceneName;
baxta86
Posts: 17
Joined: Wed Jun 30, 2021 7:53 am

Re: Calling the scene from my saved file

Post by baxta86 »

Perfect! As always, thank you for your help :)
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Calling the scene from my saved file

Post by Tony Li »

Happy to help!
Post Reply