Collision with trigger is not working
Here's code. I had marked collider on this object as "IsTrigger". Also i taged my player and bullet objects with appropriate tags (as in the code) and it still doesn't work. Triggered object just pass through the bullets and player. All of the objects have both colliders and rigidbody2D. As I tested with Debug.Log it just does not collide. Help please
void OnTriggerEner2D(Collider2D other)
{
if (other.gameObject.tag == "Player" || other.gameObject.tag == "Bullet(Clone)") {
Destroy (this.gameObject);
Destroy (other.gameObject);
}
}
Answer by NIMBLE_JIM · Jul 17, 2016 at 10:32 AM
You've spelt the first command wrong -
void OnTrigger*Enter*2D(Collider2D other)
Your answer
Follow this Question
Related Questions
OnTriggerEnter/Exit Rapid Firing? 0 Answers
How to check if player collides with trigger? 0 Answers
GameObject keeps colliding for sometime after being destroyed 1 Answer
How to identify which collider generated OnTriggerEnter2D 0 Answers
Destroy instatiate object on trigger enter / collision,destroy instantiate prefab on trigger enter 0 Answers