Why is the 'parent' property on transform and not gameObject?

As I see it, a gameObject contains components.

Transform is a component of a single gameObject, so in my way of thinking the parent of transform would be the gameObject, and not the parent of the whole element. So why is this?

I think 2 style reasons. One is that 3D modeling programs use a Transform for parent/child. Unity tries to be friendly to experienced game designers.

The other, related, is that parent/child is mostly about the things a Transform holds (this may be what dan_wipf is getting at). When you change position/scale/rotation in a Transform, you run through it’s child Transforms and update their stats. It’s all Transforms – you never touch a gameObject. And it’s just as easy to walk through a tree of Transforms as one of gameObjects. It feels a little weird to walk from sub-object to sub-object, but it works fine. Esp. for people who prefer using: public Transform cow; as the primary way to link to gameObjects.

Well Unity Docs says to Transform:


Every object in a scene has a Transform. It’s used to store and manipulate the position, rotation and scale of the object. Every Transform can have a parent, which allows you to apply position, rotation and scale hierarchically. This is the hierarchy seen in the Hierarchy pane.


as for GameObject it Says:


Base class for all entities in Unity scenes.


So in the end I’d say the difference is a GameObject can be anything. Like A Transform, a Script, or something else, which a Transform can’t be.
So the Parent is quite strongly connected with coordinates and size and stuff, which makes quite Sense to me that parenting is not on a “GameObject” rather on “Transform”;


hope this helped. Dan

I think “parent” and “child” are terms that can be only applied for transforms: for calculating local variables, for properly scaling, etc. GameObject is just, just like you said, container for other components, thats it.