Specify trigger zone when NPC has multiple triggers

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nickg84
Posts: 12
Joined: Mon Sep 13, 2021 1:52 pm

Specify trigger zone when NPC has multiple triggers

Post by nickg84 »

Hi everyone,

I'm very new to Unity, but learning fast! I'm not really comfortable with scripting yet (I've been using PlayMaker), so please ELI5. :)

Very simple and probably basic question: Under my Dialogue System Trigger component on my NPC, I have a Bark set to On Trigger Enter. Works great, however, I have multiple trigger colliders inside my NPC (a second is separately used for head turning). The bark appears to be activated by, obviously, all of them. Is there any way to set the bark to activate by a specific trigger when multiple are used by an NPC?
User avatar
Tony Li
Posts: 21984
Joined: Thu Jul 18, 2013 1:27 pm

Re: Specify trigger zone when NPC has multiple triggers

Post by Tony Li »

Hi,

You can put your NPC's Dialogue System Trigger on an empty child GameObject that only has a trigger collider. If only the player is allowed to trigger barks on the NPC, set the Dialogue System Trigger's Conditions > Accepted Tags to 'Player' if it's not already set. (This assumes your player GameObject is tagged 'Player'.)
nickg84
Posts: 12
Joined: Mon Sep 13, 2021 1:52 pm

Re: Specify trigger zone when NPC has multiple triggers

Post by nickg84 »

Of course it was that simple! Thank you!
User avatar
Tony Li
Posts: 21984
Joined: Thu Jul 18, 2013 1:27 pm

Re: Specify trigger zone when NPC has multiple triggers

Post by Tony Li »

Glad to help!
Post Reply