Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 /
avatar image
1
Question by Tactical Web · May 07, 2013 at 06:31 PM · transformdifference

Difference between Transform vs transform

I am currently watching some video tutorials and i saw the example below (looping through childrens):

 for (var children : Transform in transform) {
    ...
 }

Whats the difference between Transform and transform ? What does transform contain and it is used to loop inside it? Is it some kind of an array?

Also is it valid to do the same thing with the code below??:

 for (var children : GameObject in gameObject) {
    ...
 }

Thanks

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
4
Best Answer

Answer by whydoidoit · May 07, 2013 at 06:41 PM

Transform is the name of the class that contains the information about a transform. transform is a property of an object that gives you the instance of the Transform for that object. So your for loop defines a looping variable called children (it should really be child) that is going to be a Transform so you get the instance for each child.

Transform itself defines that it can have a for loop run against it and that it will return its children when you do that. The same is not true for GameObject. So to get the children you have to use the transform variable in the for loop. This is because the relationships between objects are defined by transform.parent.

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 Fred_Vicentin · May 07, 2013 at 06:49 PM

Transform is used to store and manipulate the position, rotation and scale of the objects, you can declare a Transform and drag a object to it, to get it Transform and change it Transform, for example, a Empty GameObject has nothing on it, but you can use it as a Transform to set a Spawn Position to the Player, for example:

 var spawn: Transform;
 function Update () 
 {
    //That will make you object, go to Spawn position
    transform.position =  Spawn.position;
 }

Every Object on Unity has a transform, that is represented with the cordinates and rotation value on map

When you call a transform, you are calling the value of the Transform, you can use a transform.position, or a transform.rotation for example, to get the coordinates of the gameObject, for more informations, you can access the Unity documentation that has more informations of Transform here

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
0

Answer by himanshugupta159 · Jul 20, 2018 at 08:34 AM

Written a blog related to it, check the link belowlink text

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

15 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

Related Questions

What's the difference between gameObject and transform when using GetComponent 2 Answers

Pitch/yaw difference between 2 transforms 1 Answer

Difference Between Transform.TransformVector and Transform.TransformPoint 1 Answer

How to transform points from world to camera space and back again. 1 Answer

Child Transform 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