Conversations not being saved in Textline Lobby demo

Announcements, support questions, and discussion for the Dialogue System.
xuoot
Posts: 19
Joined: Wed Jul 29, 2020 3:01 am

Conversations not being saved in Textline Lobby demo

Post by xuoot »

Hi Tony!

I wanted to ask about the Textline Lobby demo again that I've been using -- currently, when I run the demo the options aren't saved after the game is stopped and restarted(I don't see the option to continue game after playing through all of the text options). Not sure if there's a box I have to check to enable that but the Save Helper is attached to the "0 Lobby" scene so I thought it should have been saving and I see it saving when I exit and reenter conversations but after I stop the game and hit play again in Unity the data is wiped. Thanks!

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

Re: Conversations not being saved in Textline Lobby demo

Post by Tony Li »

Hi Jenny,

Let's make sure the Lobby example is working as-is in your project first. Please make sure the Lobby Example's "0 Lobby" scene is added as the first scene in build settings, and "1 Gameplay" is added as the second scene:

textlineLobby1.png
textlineLobby1.png (3.36 KiB) Viewed 760 times

Then open "0 Lobby" and inspect the Menu System GameObject. Find the PlayerPrefs Saved Game Data Storer component, and click Clear Saved Games to make sure we're starting from a clean slate:

textlineLobby1a.png
textlineLobby1a.png (13.44 KiB) Viewed 760 times

Then play "0 Lobby". You should see Adam, Barbara, Charlie:

textlineLobby2.png
textlineLobby2.png (2.65 KiB) Viewed 760 times

Click on Adam and play through a few lines:

textlineLobby3.png
textlineLobby3.png (16.36 KiB) Viewed 760 times

Then click Menu to go back to the Lobby. Then quit the game and play it again. You should now see a additional Continue Game and Restart Game buttons:

textlineLobby4.png
textlineLobby4.png (10.58 KiB) Viewed 760 times

If you click on Continue Game and then click on Adam, you should see the same Adam conversation that you left from your last play-through:

textlineLobby3.png
textlineLobby3.png (16.36 KiB) Viewed 760 times
xuoot
Posts: 19
Joined: Wed Jul 29, 2020 3:01 am

Re: Conversations not being saved in Textline Lobby demo

Post by xuoot »

Thanks Tony! For some reason the example as-is doesn't save either --
Screen Shot 2020-08-04 at 10.26.20 PM.png
Screen Shot 2020-08-04 at 10.26.20 PM.png (46.5 KiB) Viewed 759 times
This is the screenshot of the Save Helper. Seems to be set up the same way so I'm not sure what else would interfere with the saving and persistent storage. I didn't change anything in the example code. Thanks!
xuoot
Posts: 19
Joined: Wed Jul 29, 2020 3:01 am

Re: Conversations not being saved in Textline Lobby demo

Post by xuoot »

Also, would I have to add the checkbox to use a "saved game?"
Screen Shot 2020-08-04 at 11.44.30 PM.png
Screen Shot 2020-08-04 at 11.44.30 PM.png (67.52 KiB) Viewed 758 times
Just found this in the DialogueSystem wizard. Thanks!

Turning it on does trigger a bug:

Code: Select all

NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.MenuSystem.MenuUtility+<ReturnToTitleWhenDoneSaving>d__6.MoveNext () (at Assets/Dialogue System Extras/Textline/Scripts/MenuUtility.cs:64)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) 
And the line that this is referring to is: saveHelper.QuickSave();

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

Re: Conversations not being saved in Textline Lobby demo

Post by Tony Li »

Hi,

You can remove the SaveSystem component from the Dialogue Manager GameObject. In the Textline framework, the SaveSystem component is on the Menu System GameObject.

Please inspect the Menu System GameObject and tick the Debug checkboxes on the Save System component and the PlayerPrefs Saved Game Data Storer component.

If you don't see any of these components, please add them: Save System, PlayerPrefs Saved Game Data Storer, Json Data Serializer, and Auto Save Load. On Auto Save Load, make sure Save On Quit and Save On Pause are ticked.

Then play the game again, run through a line or two of Adam's conversation, return to the menu, and exit play mode. When you do this, you should see two lines similar to:

Code: Select all

TextlineDialogueUI.OnRecordPersistentData: Saving current conversation to DialogueEntryRecords_Adam
Save System: Storing in PlayerPrefs key Save1: {"m_sceneName":"1 Gameplay","m_list":[{"key":"Dialogue Manager"...
xuoot
Posts: 19
Joined: Wed Jul 29, 2020 3:01 am

Re: Conversations not being saved in Textline Lobby demo

Post by xuoot »

Thanks Tony! I turned on the Debug and checked that all of the components were there. I see this when I run through Charlie's dialogue and then go back to the menu, implying that something was saved:

Code: Select all

TextlineDialogueUI.OnRecordPersistentData: Saving current conversation to DialogueEntryRecords_Charlie
Save System: Storing in PlayerPrefs key Save0: {"m_sceneName":"1 Gameplay","m_list":[{"key":"Dialogue Manager","sceneIndex":-1,"data":"Variable={Alert=\"\", Conversation=\"Charlie\", SavedLevelName=\"1 Gameplay\", Actor=\"Player\", Conversant=\"Charlie\", ActorIndex=\"Player\", ConversantIndex=\"Charlie\", Chapter=3, CurrentConversationActor_Charlie=\"Player\", CurrentConversationConversant_Charlie=\"Charlie\", DialogueEntryRecords_Charlie=\"5;3;1;3;2;3;3;3;4;3;5;\"}; Actor={Player={Name=\"Player\", Pictures=\"[]\", Description=\"\", IsPlayer=true}, Adam={Name=\"Adam\", Pictures=\"[]\", Description=\"\", IsPlayer=false}, Barbara={Name=\"Barbara\", Pictures=\"[]\", Description=\"\", IsPlayer=false}, Charlie={Name=\"Charlie\", Pictures=\"[]\", Description=\"\", IsPlayer=false}}; StatusTable = \"\"; RelationshipTable = \"\"; "}]}
UnityEngine.Debug:Log(Object)
PixelCrushers.PlayerPrefsSavedGameDataStorer:StoreSavedGameData(Int32, SavedGameData) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/Storers/PlayerPrefsSavedGameDataStorer.cs:60)
PixelCrushers.<StoreSavedGameDataAsync>d__8:MoveNext() (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/Storers/SavedGameDataStorer.cs:48)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
However, when I restart the scene, the Continue screen doesn't show up. Could I perhaps be saving to the wrong PlayerPref key? I'm using Unity 2018.4.01f. Thanks!
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversations not being saved in Textline Lobby demo

Post by Tony Li »

Hi,

Try setting the Auto Save Load component's save slot number to 0. I believe it defaults to 1.
xuoot
Posts: 19
Joined: Wed Jul 29, 2020 3:01 am

Re: Conversations not being saved in Textline Lobby demo

Post by xuoot »

Thanks Tony! Changing the Save slot on the Auto Save + Checking the Load On Start box ended up working!
Screen Shot 2020-08-05 at 8.58.21 PM.png
Screen Shot 2020-08-05 at 8.58.21 PM.png (42.61 KiB) Viewed 734 times
However, as soon as I open the game this "Load on Start" setting causes the game too jump into the conversation scene that I left off at (but it saves now!). Is there a way to have it instead stay on the Lobby scene on Load?
xuoot
Posts: 19
Joined: Wed Jul 29, 2020 3:01 am

Re: Conversations not being saved in Textline Lobby demo

Post by xuoot »

Actually I figured it out -- I had to uncheck "Save Current Scene" and it goes to the Lobby screen! Everything saves and loads but I don't see the "Continue Game" button and I don't see the anything under the "Saved games" list even after having a saved game.
Screen Shot 2020-08-05 at 9.14.42 PM.png
Screen Shot 2020-08-05 at 9.14.42 PM.png (135.19 KiB) Viewed 733 times
Maybe the save slot is still in the wrong place?
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversations not being saved in Textline Lobby demo

Post by Tony Li »

Hi,

Keep Save Current Scene ticked.

Untick the Auto Save Load component's Load On Start.
Post Reply