- Home /
How do I specify which collider I'm using for a trigger?
So I have two CircleCollider2D components attached to my enemy, one of them is for colliding with surroundings and the other has a radius of about ten times the width of the enemy and is used for a trigger for the enemy's vision. So when I say OnTriggerEnter, how does Unity know which trigger I want it to use? I'm asking because nothing happens when the player enters the enemy's field of vision and I think it's because of the fact that there is more than one collider. Thanks.
Answer by Trevdevs · Jun 27, 2018 at 02:33 AM
I wouldn't set this up that way as I don't know if there is a way of doing it like that here is what you should do.
Create a child empty gameobject on the main one and have a collider on each with 2 scripts that each specifiy what each one does.
I've done this before but it's just so annoying to have yet another gameobject for every enemy.
Your answer