Querying the dialogue system: are you active?
-
- Posts: 30
- Joined: Sat Jan 19, 2019 2:14 pm
Querying the dialogue system: are you active?
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?
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.
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.
-
- Posts: 30
- Joined: Sat Jan 19, 2019 2:14 pm
Re: Querying the dialogue system: are you active?
Number one sounds easiest! Thank you very much.
Re: Querying the dialogue system: are you active?
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.
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.