Page 1 of 1

Querying the dialogue system: are you active?

Posted: Thu Jan 31, 2019 7:05 pm
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?

Re: Querying the dialogue system: are you active?

Posted: Thu Jan 31, 2019 9:06 pm
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.

Re: Querying the dialogue system: are you active?

Posted: Fri Feb 01, 2019 9:03 am
by Dragonception
Number one sounds easiest! Thank you very much.

Re: Querying the dialogue system: are you active?

Posted: Fri Feb 01, 2019 9:25 am
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.