- Home /
Is transform another name for a gameObject?
Is transform another name is a gameObject? When the docs are talking about parenting here, they mention the parent of the transform. What does this mean?
to be honest after the answers I still don't understand, I understand how to use it, since I have seen many examples but still it is peculiar because you use it sometimes as a pointer to go to another gameObject, find the parent, or some other times as a pointer to move something with translate. But is it a container of movement/rotation/scale?
@alexnode: as ian scilipoti says below, a transform is not a game object. Rather, a GameObject has a Transform component, and a Transform component knows which GameObject it belongs to. Furthermore, the scene-hierarchy, which is often shown as a GameObject-hierarchy, is really a Transform-hierarchy, but as there is a one-to-one relationship between GameObjects and Transforms, it can consistently be shown as a GameObject-hierarchy.
Answer by 3dDude · Apr 13, 2010 at 01:52 AM
a Transform is not a gameObject but when you are talking about parents and children that is in the transform class
Answer by dhendrix · Apr 13, 2010 at 01:58 AM
It's referring to the transform of the parent of the current gameObject's transform.
If that confuses you look at some examples. This sets the parent of the gameObject the script it is attached to:
transform.parent = anotherGameObject.transform;
Or a gameObject could set itself to be the parent of another gameObject(this script would be attached to the parent):
anotherGameObject.transform.parent = transform;
Hopefully that helps you understand better. It's very intuitive once you wrap your head around it.