Adding nodes makes them all turn invisible, but the bezier curves stay

I am using Unity 2021.1.3f1 and everything works great up until the adding of the new nodes. I will click on the button to add new nodes and then this will happen:

The only way I’ve found to remedy this is by moving the invisible node that was spawned in by dragging next to the bezier curve, then pressing ctrl+z to undo the move, and for some reason that makes everything reappear. It’s functional, but not conducive to a good user experience, and since I am going to have people other than me in the editor making dialogue, I’d like for an easier solution. I have already tried to just recreate the movement + undo in code, but all I’ve accomplished from that vein of thinking is immediately deleting the node that was just created. I’m sure it’s a problem of just me putting my Undo.PerformUndo() in the wrong place, but I’m really not sure why this is happening, and I feel like this is a janky solution anyway, so I was wondering if you guys had any insight.

1 Like

I added this code, in an attempt to replicate the in-editor fix, just before setting the creatingNode back to null, and it breaks even further, so I am no longer sure if the way I’m trying to do this would even work if I had the things in the right place.

foreach (var child in selectedDialogue.GetAllChildren(creatingNode))
                        if (selectedDialogue.GetAllChildren(creatingNode)
                            .ElementAt(selectedDialogue.GetAllChildren(creatingNode).Count()) == child)
                            Undo.RecordObject(selectedDialogue, "Debug move");
                            child.rect.position = child.rect.position + new Vector2(1, 1);

I’m stumped by this whole thing to be quite frank, and I’m hoping someone smarter than me has a better idea of what’s going on.

It seems as though I’m getting an error I didn’t notice before, maybe it’s related:

NullReferenceException: Object reference not set to an instance of an object
RPG.Dialogue.Dialogue+d__6.MoveNext () (at Assets/RPG/Dialogue/Dialogue.cs:47)
RPG.Dialogue.Editor.DialogueEditor.DrawConnections (RPG.Dialogue.DialogueNode node) (at Assets/RPG/Dialogue/Editor/DialogueEditor.cs:199)
RPG.Dialogue.Editor.DialogueEditor.OnGUI () (at Assets/RPG/Dialogue/Editor/DialogueEditor.cs:75)

I’ve found another solution to fix the bug, but it seems like it will not be possible to replicate in code. If you manually change the DialogueNode's position, all the nodes come back (even if you use the exact same position). Not really sure what’s happening at this point. I’m considering just downgrading to an LTS build or upgrading to the newest 2021 build.

I have fixed the problem, and I wish I could say I knew how. I basically went back and rebuilt everything. Even looking at the changes I made in the commit I can’t tell what was causing the problem, but I’m glad it’s gone. I guess if you have any guesses it’d be nice to understand the error, but I’m not going to worry about it too much.

The error message is your clue, here. Something was causing a null-reference error, and at that point, the rest of the dialogue wasn’t filling in. As Editor Code is a pain in the politician to debug, it’s difficult to say what the exact error was.
I’ve done a lot of experimenting with edtior code, and have managed to make even stranger looking windows than yours. :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms