Root of prefab

Hi all,

Some of my objects have multiple colliders; but a script is only attached to the root object.
On a collision potentially any collider within the object could trigger and it makes it difficult to get component; because it depends on which collider was hit. Too make matters worse the object can sometimes have a parent…

So ‘root’ are out of the question. I guess I am looking for a ‘root of this prefab’ based on the collider.

Any suggestions?

Thanks

collider.transform.root

Hi,

Nope doesn’t work.
It my game object has a collider and I parent it to another object, then collider.transform.root is the root of everything NOT the object(prefab) in question.
root is always the root of everything i.e. top of the hierarchy ; and as my post says I want the top of the prefab within the hierarchy.

thanks though :slight_smile: