Dialogue System: In ShowResponses(): Object reference not set to an instance of an object

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
JeanBis
Posts: 4
Joined: Mon Sep 28, 2020 3:38 pm

Dialogue System: In ShowResponses(): Object reference not set to an instance of an object

Post by JeanBis »

Hi tony,
I have a strange problem and I don't quite understand the cause of this.
The error appear when a response window should appear, but this appen only in a build, in the editor everything work just fine.

The error is here [AbstractDialogueUI.cs Line: 304]

At that point in the script, every possible null reference exception is handled by the try/catch block, so what is null? and why this error only appears in build?

Thanks for your time ;)
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue System: In ShowResponses(): Object reference not set to an instance of an object

Post by Tony Li »

Hi,

Can you please provide more information?

You could also try commenting out the try...catch code so the NullReferenceException won't be caught and ignored. This may help you pinpoint the exact location of the error.
JeanBis
Posts: 4
Joined: Mon Sep 28, 2020 3:38 pm

Re: Dialogue System: In ShowResponses(): Object reference not set to an instance of an object

Post by JeanBis »

Ok fixed!

commenting out those lines moved the error to [StandardUIMenuPanel.cs Line:457].

Something with template button navigation causes the error, so I set to false the bool "ExplicitNavigationForTemplateButtons" in "StandardUIMenuPanel" and everything works fine, now i have to set the buttons manually, but that's ok.

Thank you very much :D
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue System: In ShowResponses(): Object reference not set to an instance of an object

Post by Tony Li »

Hi,

What version of the Dialogue System are you using?

(Menu item Tools > Pixel Crushers > Dialogue System > Welcome Window, or look in _README.txt.)
JeanBis
Posts: 4
Joined: Mon Sep 28, 2020 3:38 pm

Re: Dialogue System: In ShowResponses(): Object reference not set to an instance of an object

Post by JeanBis »

The latest version, 2.2.11

However the problem occurred also in a previous version, I don't remember which one, I updated yesterday in the hope that it would solve itself.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue System: In ShowResponses(): Object reference not set to an instance of an object

Post by Tony Li »

Hi,

Does your template button have a Unity UI Button component?

In any case, this patch provides some extra checking that may resolve the issue:

DS_MenuPanelPatch_2020-09-29.unitypackage
JeanBis
Posts: 4
Joined: Mon Sep 28, 2020 3:38 pm

Re: Dialogue System: In ShowResponses(): Object reference not set to an instance of an object

Post by JeanBis »

Hi tony,

I figure out what caused the error, in my button template, somehow, I lost the reference to the unity Button in the StandardUIResponseButton component.

Even if StandardUIResponseButton check the presence of the Button component in Awake and assign it automatically, in some way in the build, the variable is null, maybe because the gameobject is disabled from the start until is being used.

Now everything work as expected, thank you very much for your time and your patch :D
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue System: In ShowResponses(): Object reference not set to an instance of an object

Post by Tony Li »

Glad to help!
Post Reply