On Use not working

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 21033
Joined: Thu Jul 18, 2013 1:27 pm

Re: On Use not working

Post by Tony Li »

Hi,

Glad you got it working! :-)
TomsTales
Posts: 16
Joined: Tue Apr 27, 2021 6:38 am

Re: On Use not working

Post by TomsTales »

Well, what is working CAN be destroyed :o

I was doing something completely different with a Canvas and a Text element. And I am pretty sure I accidentally deleted the Dialogue System Prefab Canvas. At least that is what I can track, no idea what I did otherwise. Good job, me!

I opened a new project and copied the info from a fresh import of everything, but it still is not working. I can only hope you see something! Maybe the Canvas needs to be assigned somewhere I didnt see (I assigned it to dialog manager default and instantiate prefab canvas)?

Also, there are suddenly red lines in the project - I see where they are coming from, but I dont think they have been there before?

To add: Mouse over does detect that there is an interactable object, but it (again, sigh) does not open the dialog.
dialogsystem.JPG
dialogsystem.JPG (87.17 KiB) Viewed 1072 times
canvas.JPG
canvas.JPG (53.51 KiB) Viewed 1072 times
dontdestroy.JPG
dontdestroy.JPG (16.28 KiB) Viewed 1072 times
redlines.JPG
redlines.JPG (13.92 KiB) Viewed 1072 times
User avatar
Tony Li
Posts: 21033
Joined: Thu Jul 18, 2013 1:27 pm

Re: On Use not working

Post by Tony Li »

Hi,

In your dontDestroy.JPG image, notice that the "Basic Standard..." UIs are being instantiated as direct children of the Dialogue Manager GameObject and not inside the Canvas. Since these UIs use Unity UI, they must be children of a Canvas.

I see that a Canvas is assigned to the Dialogue Manager's Instantiate Prefabs component > Parent. Is the correct Canvas assigned?

If you want to avoid this issue entirely, you can disable the Instantiate Prefabs component and manually add the UIs to the Dialogue Manager's Canvas at design time.

---

As for why it doesn't start the conversation, are there any warnings in the Console window?

Does the NPC have a Dialogue System Trigger component set to OnUse?

If so, check the Conditions section. When you try to interact with the NPC, the Conditions section should show (Last Check: True) or (Last Check: False). If it says False, this means one or more conditions failed their check, so it won't run the trigger's Actions.

If it says True, then temporarily set the Dialogue Manager's Other Settings > Debug Level to Info and reproduce the issue. Look for a line like:

Dialogue System: Dialogue System Trigger is firing OnUse.

If you don't see that line, then the Dialogue System Trigger isn't being triggered.

If you see that line, then look below for a line like:

Dialogue System: Starting conversation 'title' with actor=X and conversant=Y

You may instead see some other lines, such as "Dialogue System: Block On False Link". If the Dialogue System determines that there are no lines of dialogue to show (e.g., all of their conditions are currently false), it won't start the conversation.
TomsTales
Posts: 16
Joined: Tue Apr 27, 2021 6:38 am

Re: On Use not working

Post by TomsTales »

Hi Tony,

I am as sure as I can be that all objects are fine as everything worked well until I did "something" with the canvas, so all objects did start conversations and have everything up.

The UI is now a child of the canvas:
canvas2.JPG
canvas2.JPG (18.31 KiB) Viewed 1068 times
This is what the console shows with info activated. Reads like everything is fine as far as I can see :? but neither do I see dialog, nor is the player controller deactivated (what worked before):
info.JPG
info.JPG (25.66 KiB) Viewed 1068 times
User avatar
Tony Li
Posts: 21033
Joined: Thu Jul 18, 2013 1:27 pm

Re: On Use not working

Post by Tony Li »

Assuming Johnny is your player GameObject, those screenshots look perfect, except I have one question: Are there any other lines in the Console log after "Dialogue System: Starting conversation..."?

How are you deactivating the player controller? A Dialogue System Events component on the player? If so, is Johnny the player? Is there more than one GameObject named Johnny? (Just checking, in case it's using the wrong one for some reason.)

With play mode stopped, can you see the dialogue UI in the Game view? If not, then maybe there's an issue with the Canvas.

Can you send a reproduction project to tony (at) pixelcrushers.com?
TomsTales
Posts: 16
Joined: Tue Apr 27, 2021 6:38 am

Re: On Use not working

Post by TomsTales »

Hi Tony,

somehow the database broke. All conversation were not found, not sure why. All I did was renaming at some point and well deleting the Canvas :?

Anyway, with a new database and fresh conversation, all is working again, I just have to copy paste a bit but that's not bad as it's a bit of a testing project for later Super-Triple-AAA-Stuff later on :lol:

Cheers & keep up the good work
T
User avatar
Tony Li
Posts: 21033
Joined: Thu Jul 18, 2013 1:27 pm

Re: On Use not working

Post by Tony Li »

Hi,

I'm glad you got it working again. Note that Dialogue System Triggers reference conversations by title. If you rename a conversation's title in the database, you'll need to re-select the conversation in the Dialogue System Trigger. If a Dialogue System Trigger has an unassigned conversation, it will log a warning in the Console, so keep an eye out for warnings as you playtest.
Post Reply