- Home /
Check if a Collider2D is hit by a Trigger Collider2D
Hello, i have a problem while trying to detect a "hit" between a Sword that has a Trigger Collider2D, and an Enemy that has a Collider2D, while trying to manage it in the Enemy's script.
I've been looking for similar answers but i cant find anything similar to :
void OnEnterCollision2D(TriggerCollider collider)
{
//Whatever
}
So, basically, i just want -The Enemy- in his own script to detect when it's been hit by a trigger collider
Answer by Huntzie · Nov 16, 2015 at 04:35 PM
You are looking for:
void OnTriggerEnter2D(Collider2D col)
{
//xyz
}
Your answer
Follow this Question
Related Questions
2D Triggers and Collisions not working as expected. 2 Answers
[2020.3][2D Collision] Trigger collider with physics computation 0 Answers
OnTriggerEnter2D problem on created collider2d and rigidbody2d during runtime 0 Answers
Closed - Go to next scene on collision 1 Answer
How to make a little wiggle room for the collision? 1 Answer