I fixed a bug when I create a new Dialogue and enter or click somewhere

After creating a new Dialogue and click with the mouse somewhere the first time, it gives me an error at the OnValidate() methode.

My fix very simple.

Fixed bug

Out of curiousity, which version of Unity are you using? That particular patch hasn’t been working for me. (Bug present in 2022.1 and 2022.2.2 – NRE actually pops up on the if(node!=null) line!)

Hey all,

take this with a grain of salt since I’ve only been doing this for about 4 months now, but after digging through a couple threads for this problem I was bummed that the fixes that others have tried weren’t working for me (shout out to Brian for putting in 100% for everyone!).

I’ve noticed a possible workaround after restarting Unity. If I create a New Dialogue, try to click on the node – POOF! Gone – and then save and restart, the node appears again on restart and behaves normally. Of course, it’s a pain to restart each time but maybe that will help someone else.

Follow-up:
It looks like the end section of the “Asset Database” lecture might fix this problem by creating a root node if it’s not there. I get an initial console error message but it otherwise behaves (seemingly) like it should.

Hi Brian
I use Unity version: 2021.3.16f1

and sorry for my late reply. I was very busy.

Yeah, we don’t have an actual fix for the bug, except to note that it throws an error once you finish creating the item, but then it immediately works properly afterwards. It looks like what is happening is that Unity has switched to a Jobs system to handle serialization, and when it goes from only existing in memory to being saved, new references are created, causing the null reference errors in OnValidate()

1 Like

Okay.
Thanks for explanation.

Hi Dark_Lizard, thank you I had the same problem. I was thinking how to fix “node” problem yesterday. This is working for me.

:+1:

Privacy & Terms