Multiple Levels Of Parenting

I have a contact Point parented on a model’s bone, this bone has several other bones that it is connected to. How would I go about calling a script on the “lead parent”?

transform.parent doesn’t work because it only returns the bone that the contact point is parented to.

That is a singularly ugly line of code. :wink: I like it, kind of like how gremlins can be cute.

Have you considered SendMessageUpwards instead? It will work for you if the MonsterObj is the only script in this GameObject tree that has an Attack function.

If that is not an option, you can also do a GameObject.Find(“NameOfTopLevelParent”).GetComponent(“MonsterObj”) in the Start function of the contact point’s script. That would cache the target script and allow you to call Attack() directly on that variable, instead of traversing a crazy parent-child tree like that.

Surprisingly THIS worked.
transform.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.GetComponent("MonsterObj").Attack;