stopping trigger disable

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
glen
Posts: 16
Joined: Mon Nov 22, 2021 10:06 am

stopping trigger disable

Post by glen »

Hi there, hope all is well.
I have a very simple noob question even though I have been learning this system for a couple years now already. I want to create a trigger event that when i move close to an npc he just says 'get lost'. This works easily by just putting an audio source in the game, putting a collider to it set with a trigger. I put a dialogue system on trigger enter event to enable to audio component and it works fine. The problem is that upon doing it once the Dialogue System seems to disable / destroy the trigger effect.
I want to do it so the sound is played whenever i go near him, not just once. Is there an easy way for this I am overlooking, sorry been away for awhile and might have forgotten something simple. Any help appreciated

edit: I am using invector too by the way, if there is a generic trigger that works better with that? As far as I know they are using dialogue manager triggers any how.
Last edited by glen on Mon Jul 08, 2024 3:55 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 22140
Joined: Thu Jul 18, 2013 1:27 pm

Re: stopping trigger disable

Post by Tony Li »

Hi,

A Dialogue System Trigger set to OnTriggerEnter should run every time the player enters the trigger collider, not just once. Did you configure something in its Actions section to deactivate the GameObject or disable the Dialogue System Trigger? Or, if you're playing "Get lost" with a conversation, does the conversation's dialogue entry deactivate or disable it?
glen
Posts: 16
Joined: Mon Nov 22, 2021 10:06 am

Re: stopping trigger disable

Post by glen »

it only plays once. Only action I have is to enable the audio source. I did read this in the range trigger notes:
''When OnTriggerExit occurs, the GameObjects are deactivated and components disabled. This component is useful to enable components such as Bark On Idle only when the player enters a trigger collider that represents proximity to the barker. You can also configure UnityEvents to run on enter and exit.''
idk if that's whats happening here?
I will try the trigger with a different game object set up and see if i have the same issue
edit: could it be invector messing with the triggers?
User avatar
Tony Li
Posts: 22140
Joined: Thu Jul 18, 2013 1:27 pm

Re: stopping trigger disable

Post by Tony Li »

Ah, if it's only enabling the audio source, then it will only play once (i.e., when it's first enabled). Instead:

1. Keep the audio source component enabled.
2. UNtick its Play On Awake checkbox.
3. Configure the Dialogue System Trigger to call the audio source component's Play method (AudioSource.Play).
glen
Posts: 16
Joined: Mon Nov 22, 2021 10:06 am

Re: stopping trigger disable

Post by glen »

I followed your steps.
It works perfectly.
Thank you
you are a legend
User avatar
Tony Li
Posts: 22140
Joined: Thu Jul 18, 2013 1:27 pm

Re: stopping trigger disable

Post by Tony Li »

Happy to help!
Post Reply