HOw to access to parent object (not parent transform)?

Hello,

I create a GameObject, and I associated a script with a function called “registerDocks()”.
Now this GameObject is a “container” for other game objects:

MASTER_GAME_OBJECT_1 <-- function is here!
  |
  +-Child_GO_1
  +-Child_GO_2
  +-Child_GO_3
  |
  MASTER_GAME_OBJECT_2 <-- function is here!
  +-Child_GO_4
  +-Child_GO_5
  +-Child_GO_6

I need to call that function from Child objects.
I tried with (script in child):

transform.parent.registerDocks(this);

But Unity told me that “transform” object does not contain registerDocks().

HOw can I get access to the parent function and not to the “parent transform object”?
Please consider I do not want to use “Find()”. I need to work with the parent of an object.

Thank you for your help!

the game object to which a component is related to is always stored in gameObject

your code though will never work, as you have that code in a specific behaviour, so you need to go to the parent and use GetComponent to get that behaviour at all and in C# you additionally need to type cast it to the right one.

GetComponent()!!! Thank you! I forgot about that function!
:smile: