Centralized save manager events

Announcements, support questions, and discussion for Love/Hate.
dkrusenstrahle
Posts: 39
Joined: Sat Apr 20, 2024 7:03 pm

Centralized save manager events

Post by dkrusenstrahle »

Hello,

I am struggling a bit to wrap my head around saving.
Currenly I am using Topdown engine and Inventory engine and generally save using Inventory engine.
I am trying to make everything centralized (for all my assets) and I think the Easy Save asset can handle all.

So what need is a way to keep track of changes in Love/hate and Quest Machine (that I am also using).
Is there events that I can listen to for Love/Hate and Quest machine?

My idea is to get that data and save it in one central place (I also want to support different saves for the game).

I try to use the Pixelcrushers system but I get this when I try to load:

Code: Select all

MissingReferenceException: The object of type 'UnityUIQuestDialogueUI' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Component.GetComponent[T] () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/Component.bindings.cs:42)
PixelCrushers.QuestMachine.UnityUIBaseUI.Show () (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Content Templates/UnityUIBaseUI.cs:94)
PixelCrushers.QuestMachine.UnityUIQuestDialogueUI.ShowContents (PixelCrushers.QuestMachine.QuestParticipantTextInfo speaker, System.Collections.Generic.List`1[T] contents) (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Quest Dialogue UI/UnityUIQuestDialogueUI.cs:149)
PixelCrushers.QuestMachine.UnityUIQuestDialogueUI.ShowActiveQuest (PixelCrushers.QuestMachine.QuestParticipantTextInfo speaker, PixelCrushers.QuestMachine.Quest quest, PixelCrushers.QuestMachine.QuestParameterDelegate continueHandler, PixelCrushers.QuestMachine.QuestParameterDelegate backHandler) (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Quest Dialogue UI/UnityUIQuestDialogueUI.cs:254)
PixelCrushers.QuestMachine.QuestGiver.ShowActiveQuest (PixelCrushers.QuestMachine.Quest quest) (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:771)
PixelCrushers.QuestMachine.QuestGiver.StartMostRelevantDialogue () (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:682)
PixelCrushers.QuestMachine.QuestGiver.StartDialogue (UnityEngine.GameObject player) (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:595)
PixelCrushers.QuestMachine.QuestGiver.StartDialogueWithPlayer () (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:565)
CharacterQuestGiverActivation.Update () (at Assets/Game/General/Scripts/Extentions/Character/CharacterQuestGiverActivation.cs:12)
Attachments
Screenshot 2024-04-24 at 09.38.58.png
Screenshot 2024-04-24 at 09.38.58.png (144 KiB) Viewed 1972 times
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Centralized save manager events

Post by Tony Li »

Hi,

To fix that error:
Unless you need a quest giver to use a specific quest dialogue UI that's different from the dialogue UI assigned to the Quest Machine GameObject, leave its Dialogue Content > Quest Dialogue UI field unassigned. When it's unassigned, it will use the Quest Machine GameObject's dialogue UI by default.

Keep your Pixel Crushers save system components as you have them configured in your screenshot above. But you may want to UNtick the Save System component's Save Current Scene so it doesn't try to load a scene when restoring saved data.

Then add a SaveSystemTopDownEventListener component. This will tie the Pixel Crushers save system into TDE/IE's save system. When TDE/IE saves a game, it will pull in the Pixel Crushers save data.

Finally, replace your MMLoadingManager component with PixelCrushersMMSceneLoadingManager. This will handle Pixel Crushers save system persistence when changing scenes.
dkrusenstrahle
Posts: 39
Joined: Sat Apr 20, 2024 7:03 pm

Re: Centralized save manager events

Post by dkrusenstrahle »

Thanks!

Trying it out now, but SaveSystemTopDownEventListener cannot be found..
I have added it to my project.
Attachments
Screenshot 2024-04-24 at 17.35.52.png
Screenshot 2024-04-24 at 17.35.52.png (50.09 KiB) Viewed 1968 times
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Centralized save manager events

Post by Tony Li »

Hi,

Did you find the script? It's in the Plugins/Pixel Crushers/Common/Third Party Support/TopDown Engine Support.unitypackage
dkrusenstrahle
Posts: 39
Joined: Sat Apr 20, 2024 7:03 pm

Re: Centralized save manager events

Post by dkrusenstrahle »

Yes, I have unpacked that TopDown Engine Support.unitypackage and they landed in here:
But I cannot add them as a component.
Attachments
Screenshot 2024-04-24 at 18.36.15.png
Screenshot 2024-04-24 at 18.36.15.png (73.08 KiB) Viewed 1958 times
dkrusenstrahle
Posts: 39
Joined: Sat Apr 20, 2024 7:03 pm

Re: Centralized save manager events

Post by dkrusenstrahle »

Ok, I unpacked all again, in right order this time and I can now add SaveSystemTopDownEventListener to savesystem object.
Last step "Finally, replace your MMLoadingManager component with PixelCrushersMMSceneLoadingManager. This will handle Pixel Crushers save system persistence when changing scenes."

Where do I do this change?
Attachments
Screenshot 2024-04-24 at 18.56.13.png
Screenshot 2024-04-24 at 18.56.13.png (79.36 KiB) Viewed 1953 times
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Centralized save manager events

Post by Tony Li »

Hi,

Open your loading screen scene, and replace the MMLoadingSceneManager component (e.g., on your LoadingScreenManager GameObject) with the subclass as described in: How To: Use Corgi / TopDown Engine MMSceneLoadingManager
dkrusenstrahle
Posts: 39
Joined: Sat Apr 20, 2024 7:03 pm

Re: Centralized save manager events

Post by dkrusenstrahle »

Is this correct?
Attachments
Screenshot 2024-04-25 at 09.43.53.png
Screenshot 2024-04-25 at 09.43.53.png (173.62 KiB) Viewed 1945 times
Screenshot 2024-04-25 at 09.43.49.png
Screenshot 2024-04-25 at 09.43.49.png (223.04 KiB) Viewed 1945 times
dkrusenstrahle
Posts: 39
Joined: Sat Apr 20, 2024 7:03 pm

Re: Centralized save manager events

Post by dkrusenstrahle »

The above seems to work but when I leave for another scene and then return I get this error when I try to interact with a questgiver:

Code: Select all

MissingReferenceException: The object of type 'UnityUIQuestDialogueUI' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Component.GetComponent[T] () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/Component.bindings.cs:42)
PixelCrushers.QuestMachine.UnityUIBaseUI.Show () (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Content Templates/UnityUIBaseUI.cs:94)
PixelCrushers.QuestMachine.UnityUIQuestDialogueUI.ShowContents (PixelCrushers.QuestMachine.QuestParticipantTextInfo speaker, System.Collections.Generic.List`1[T] contents) (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Quest Dialogue UI/UnityUIQuestDialogueUI.cs:149)
PixelCrushers.QuestMachine.UnityUIQuestDialogueUI.ShowCompletedQuest (PixelCrushers.QuestMachine.QuestParticipantTextInfo speaker, System.Collections.Generic.List`1[T] quests) (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Quest Dialogue UI/UnityUIQuestDialogueUI.cs:264)
PixelCrushers.QuestMachine.QuestGiver.ShowCompletedQuest () (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:792)
PixelCrushers.QuestMachine.QuestGiver.StartMostRelevantDialogue () (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:697)
PixelCrushers.QuestMachine.QuestGiver.StartDialogue (UnityEngine.GameObject player) (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:595)
PixelCrushers.QuestMachine.QuestGiver.StartDialogueWithPlayer () (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:565)
CharacterQuestGiverActivation.Update () (at Assets/Game/General/Scripts/Extentions/Character/CharacterQuestGiverActivation.cs:12)

MissingReferenceException: The object of type 'UnityUIQuestDialogueUI' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Component.GetComponent[T] () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/Component.bindings.cs:42)
PixelCrushers.QuestMachine.UnityUIBaseUI.Show () (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Content Templates/UnityUIBaseUI.cs:94)
PixelCrushers.QuestMachine.UnityUIQuestDialogueUI.ShowContents (PixelCrushers.QuestMachine.QuestParticipantTextInfo speaker, System.Collections.Generic.List`1[T] contents) (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Quest Dialogue UI/UnityUIQuestDialogueUI.cs:149)
PixelCrushers.QuestMachine.UnityUIQuestDialogueUI.ShowOfferQuest (PixelCrushers.QuestMachine.QuestParticipantTextInfo speaker, PixelCrushers.QuestMachine.Quest quest, PixelCrushers.QuestMachine.QuestParameterDelegate acceptHandler, PixelCrushers.QuestMachine.QuestParameterDelegate declineHandler) (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Quest Dialogue UI/UnityUIQuestDialogueUI.cs:224)
PixelCrushers.QuestMachine.QuestGiver.ShowOfferQuest (PixelCrushers.QuestMachine.Quest quest) (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:755)
PixelCrushers.QuestMachine.QuestGiver.StartMostRelevantDialogue () (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:686)
PixelCrushers.QuestMachine.QuestGiver.StartDialogue (UnityEngine.GameObject player) (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:595)
PixelCrushers.QuestMachine.QuestGiver.StartDialogueWithPlayer () (at Assets/ThirdParty/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:565)
CharacterQuestGiverActivation.Update () (at Assets/Game/General/Scripts/Extentions/Character/CharacterQuestGiverActivation.cs:12)
dkrusenstrahle
Posts: 39
Joined: Sat Apr 20, 2024 7:03 pm

Re: Centralized save manager events

Post by dkrusenstrahle »

An update. I unticked "Allow only one instance" and it works fine again.
I have a "quest machine configuration" object on every scene (not sure if it ok) if they for example start on that sub scene and not the starting one.

Is this practice correct?
Attachments
Screenshot 2024-04-25 at 10.47.08.png
Screenshot 2024-04-25 at 10.47.08.png (166.14 KiB) Viewed 1941 times
Post Reply