OnTriggerEnter

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
SealDev
Posts: 85
Joined: Thu Jun 24, 2021 5:45 am

OnTriggerEnter

Post by SealDev »

Would it be possible to use a Dialogue System Trigger component with ontriggerenter so that it runs every frame?
I'm aware this would be bad for conversations but also very useful for running Sequence commands!
You can also use SendMessage to run a function every frame but only while inside a trigger. How cool is that!



Alternatively, if I can run this code on update. Is it bad for performance?

Code: Select all

//trigger = GetComponent<DialogueSystemTrigger>();
    void Update()
    {
        trigger.OnUse();
    }
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnTriggerEnter

Post by Tony Li »

Hi,

It's possible to do that, but I wouldn't recommend it for performance reasons. If you can write it natively in C#, it will be more performant. For example, you can use OnTriggerStay:

Code: Select all

void OnTriggerStay(Collider other)
{
    if (other.CompareTag("Player"))
    {
        SomeFunction();
    }
}
Post Reply