Querying the dialogue system: are you active?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Dragonception
Posts: 30
Joined: Sat Jan 19, 2019 2:14 pm

Querying the dialogue system: are you active?

Post by Dragonception »

I want to make sure the player can't control the camera or player character when NPC's are talking to him (i.e. when the Dialogue UI is active). How can I ask the Dialogue System if this is the case from outside?
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Querying the dialogue system: are you active?

Post by Tony Li »

Here are two ways:

1. Check DialogueManager.isConversationActive.

2. Or add a Dialogue System Events component to the player. Configure the OnConversationStart() event to disable the player's controls. Configure OnConversationEnd() to re-enable them. For an example, see the player in DemoScene1 or the bottom part of the Interaction Tutorial.
Dragonception
Posts: 30
Joined: Sat Jan 19, 2019 2:14 pm

Re: Querying the dialogue system: are you active?

Post by Dragonception »

Number one sounds easiest! Thank you very much.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Querying the dialogue system: are you active?

Post by Tony Li »

Number one is easiest, but depending on where you use it, it may involve polling -- that is, constant checking such as in Update().

Number two is slightly more efficient because it's event-driven. Instead of constantly checking, it just runs once when a conversation starts and once when the conversation ends.

The performance difference may be absolutely negligible, though.
Post Reply