On Use command and Variables
Posted: Wed Apr 21, 2021 6:23 am
I'm using the "On Use" command trigger to start a conversation with a 2D NPC but it doesn't work (it works with "On Start").
I'll explain the steps I made:
- I Imported the DialogueManager and created a DialogueDatabase and setted it as Reference database
- I Created my conversation
- I Created an NPC and a Player
- The Player has the selector component (I increased the distance for the selection just in case); the NPC has a Sprite Renderer, a Box collider set on "Is Trigger"; a Dialogue System Trigger set on "On Use" with the right Dialogue Database Reference and the Action to start the right conversation; and an Usable component (Max distance 30).
I have enabled the 2D Physics just in case, but doesn't change anything, I can't select the NPC to start the conversation, and the Selector does not display anything if the mouse position is on the NPC box collider.
Here the scene:
[removed]
I'm using Unity 2020 LTS, but I tried 2019 LTS with the same result.
Second question: Is it possible to read a variable from the database and change its value from a C# script like you do with the animator variables? Is there a tutorial or an example for this?
Thank you in advance for the help.
I'll explain the steps I made:
- I Imported the DialogueManager and created a DialogueDatabase and setted it as Reference database
- I Created my conversation
- I Created an NPC and a Player
- The Player has the selector component (I increased the distance for the selection just in case); the NPC has a Sprite Renderer, a Box collider set on "Is Trigger"; a Dialogue System Trigger set on "On Use" with the right Dialogue Database Reference and the Action to start the right conversation; and an Usable component (Max distance 30).
I have enabled the 2D Physics just in case, but doesn't change anything, I can't select the NPC to start the conversation, and the Selector does not display anything if the mouse position is on the NPC box collider.
Here the scene:
[removed]
I'm using Unity 2020 LTS, but I tried 2019 LTS with the same result.
Second question: Is it possible to read a variable from the database and change its value from a C# script like you do with the animator variables? Is there a tutorial or an example for this?
Thank you in advance for the help.