Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Riiich · Jul 05, 2018 at 09:15 PM · unityeditorprogramming

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?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Owen-Reynolds · Jul 05, 2018 at 10:59 PM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by dan_wipf · Jul 05, 2018 at 09:32 PM

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

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Riiich · Jul 05, 2018 at 09:44 PM 0
Share

So you'd say it's sort of the other way round? The transform is the base and it can contain other gameObjects?

I guess for me it's just confusing because you always reference the gameObject as the thing you're trying to manipulate, like gameObject.transform.position.x. When you right click and click "Create Empty", the new name is always gameObject in the hierarchy and not transform

That's why I see the gameObject as the "base element" and transform as a part of that gameObject

avatar image dan_wipf Riiich · Jul 05, 2018 at 09:53 PM 0
Share

well ges, you’re right as well, but if you create an empty Gameobject, it has always an transform in it.. so think as gameobject as a container which holds all together, or a unique id which walks hand in hand with a transform

avatar image
0

Answer by Perfecter · Jul 05, 2018 at 09:28 PM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

97 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to rotate object based on four vector3 points? 0 Answers

Stereo Sounds In 3D Space 1 Answer

Instantiate Method won't work a second time. 0 Answers

Why Does Unity & Mono Hate Console Output ? 1 Answer

UnityWebRequest does not work on HoloLens 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges