Completely destroy collision on contact event?

Hi there, I have two entities and a script.

Entity A gets script attached
The script adds collision on contact event to entity B
Then I destroy that script on entity A which controlls these triggers, but collision trigger still executes

Any ideas how to unset it without removing collision component?

For now I’ve just added a check if entity still has a script attached but I’m sure there’s a better way

Hi @Newbie_Coder!

Curious how you do this. Is for the on contact event not already collision needed?

I guess you need to remove the event listener. Something like below.

this.entity.collision.off('contact', this.onContact this);
1 Like