new error in 2.2.17

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
NotVeryProfessional
Posts: 150
Joined: Mon Nov 23, 2020 6:35 am

new error in 2.2.17

Post by NotVeryProfessional »

Here is a new error showing up in 2.2.17 where it didn't in 2.2.16:

Code: Select all

NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.ConversationStateSaver+<StartSavedConversation>d__6.MoveNext () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save System/ConversationStateSaver.cs:110)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
PixelCrushers.DialogueSystem.ConversationStateSaver:ApplyData(String) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save System/ConversationStateSaver.cs:80)
PixelCrushers.SaveSystem:ApplySavedGameData(SavedGameData) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:654)
PixelCrushers.<LoadSceneCoroutine>d__107:MoveNext() (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:765)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

This is most likely related to me changing scenes (via

Code: Select all

PixelCrushers.SaveSystem.LoadScene()
) with Ink tags, so the LoadScene() is actually called while a conversation is still active.

Code: Select all

    void OnPrepareConversationLine(DialogueEntry entry) {
        if (myInk && myInk.activeStory) {
            foreach (var tag in myInk.activeStory.currentTags) {
                if (tag.StartsWith("location:")) {
                    string location = tag.Substring("location:".Length).Trim(' ');
                    if (debug) Debug.Log("ink tag switching to location \""+location+"\"");
                    MessageSystem.SendMessage(this, "SCENE_CHANGE", "", location);
                }
            }
        }
    }
Fun fact: It tries to call that twice, but adding code to check if we're already in the scene we try to switch to eliminates that problem. A full console log (with that minor issue still in place) is attached, if it helps.

The relevant Ink lines are just:

Code: Select all

"... some bla bla bla"
#location: map
-> END
adding some dummy lin after the #location tag doesn't solve the issue.
Attachments
console.log
(32.06 KiB) Downloaded 44 times
User avatar
Tony Li
Posts: 22161
Joined: Thu Jul 18, 2013 1:27 pm

Re: new error in 2.2.17

Post by Tony Li »

Hi,

This isn't new in 2.2.17. ConversationStateSaver isn't compatible with the Ink integration. This is because the Ink integration uses a dummy DS conversation that's created at runtime. This conversation only has a couple of stubs, so there's nothing in it to save.

If you're only concerned about keeping the conversation going during scene changes, try this configuration:
  • Remove ConversationStateSaver.
  • Add a DialogueSystemSaver if the Dialogue Manager doesn't already have one. (Assign a unique key.)
  • UNtick the DialogueSystemInkIntegration's 'Include In Save Data'.
If you need to save the state of the conversation in saved games:
  • Remove ConversationStateSaver.
  • Add a DialogueSystemSaver if the Dialogue Manager doesn't already have one.
  • UNtick the DialogueSystemInkIntegration's 'Reset State On Conversation Start' and tick 'Include In Save Data'.
Post Reply