Page 1 of 1

[Issue] [Blocker] Cannot create new nodes; NullRefException

Posted: Fri Jun 23, 2023 4:58 am
by michaelheiml
Hi Tony,

please help!

I just updated to Unity 2022.3.2 (Mac/Silicon) and also updated (fresh import, no overwrite) the latest DSFU package: 2.2.38.1

Now, each time I want to create a new dialogue node, it does not work (Inspector stays weirdly empty) + console prints 7 times the same Null Reference Exception (editing existing nodes works):

Code: Select all

NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.DialogueEditor.DialogueEditorWindow.DrawDialogueEntryFieldContents () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Editor/Dialogue Editor/DialogueEditorWindowDialogueTreeSection.cs:679)
PixelCrushers.DialogueSystem.DialogueEditor.DialogueEditorWindow.DrawDialogueEntryInspector () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Editor/Dialogue Editor/DialogueEditorWindowDialogueTreeSection.cs:1114)
PixelCrushers.DialogueSystem.DialogueDatabaseEditor.DrawInspectorSelection () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Editor/Dialogue Editor/DialogueDatabaseEditor.cs:268)
PixelCrushers.DialogueSystem.DialogueDatabaseEditor.OnInspectorGUI () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Editor/Dialogue Editor/DialogueDatabaseEditor.cs:94)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass72_0.<CreateInspectorElementUsingIMGUI>b__0 () (at /Users/bokken/build/output/unity/unity/Editor/Mono/UIElements/Inspector/InspectorElement.cs:713)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)

Re: [Issue] [Blocker] Cannot create new nodes; NullRefException

Posted: Fri Jun 23, 2023 5:14 am
by michaelheiml
A temporary fix is this, although it does only workaround the problem:

DialogueEditorWindowDialogueTreeSection.cs line 679:
var menuText = new string("Debug"); //var menuText = menuTextField.value;

DialogueEditorWindowFieldsSection.cs line 221:
//field.value = EditorGUILayout.TextArea(field.value));

Re: [Issue] [Blocker] Cannot create new nodes; NullRefException

Posted: Fri Jun 23, 2023 8:11 am
by Tony Li
Hi,

Did you perhaps delete the "Menu Text" field from your dialogue entry template in the Dialogue Editor's Templates section? It's a required field. Here's a patch that will automatically add it back if it's missing:

DS_MissingMenuFieldPatch_2023-06-23.unitypackage

Re: [Issue] [Blocker] Cannot create new nodes; NullRefException

Posted: Fri Jun 23, 2023 9:06 am
by michaelheiml
Hi,

thanks and while your patch fixes the issue, I still wonder:

a) Before applying your patch, I've manually added the field "Menu Text" as Text Field under Templates/Dialogue Entries. It was indeed missing, but adding the field did not solve the issue. Furthermore, after adding the field and trying to create a new node (Exception again), the field was missing again under "Dialogue Entries".

b) the Dialogue Entries section looks like on the screenshot. Is there anything unusual I should be aware of?

c) I've never manually removed the field "Menu Text". Everything worked fine the past few weeks until I updated to Unity 2022.3.2 today. How would that remove a field in DSFU templates.. I am confused whats going on..
dsfu fields.png
dsfu fields.png (84.77 KiB) Viewed 250 times

Re: [Issue] [Blocker] Cannot create new nodes; NullRefException

Posted: Fri Jun 23, 2023 9:18 am
by Tony Li
Hi,

Prior to 2.2.37 (I think; I haven't checked the release notes for exact version), the editor was more forgiving about missing Menu Text, but I made some changes to accommodate the Addon for OpenAI that. The patch (and upcoming 2.2.39) handles it gracefully again now.

After adding the field, you would have needed to select Menu > Apply Template To Assets. But no need with the patch.

Re: [Issue] [Blocker] Cannot create new nodes; NullRefException

Posted: Fri Jun 23, 2023 9:42 am
by michaelheiml
Ok, thanks!