- Home /
Referencing a specific collider in a game object
Hello!
I have an object with two colliders attached. How can I distinguish them?
I mean, the collider components doesn't have a tag or name attribute, so... how can I check which one has been triggered? Or if I use GetComponents on the object, how can I know which one is returned in each position of the array?
Comment
Answer by Tehnique · Apr 12, 2015 at 01:47 PM
You can create multiple child objects, each with its own collider and its own script with "OnTriggerEnter" or whatever function you need.
Apart from this approach, you can also do it using Collisions and Contacts.