Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by lumberbunny · Feb 14, 2013 at 10:27 PM · transformperformanceparent

Why is constructing a cube from 6 faces so much slower?

I'm drawing a couple hundred cubes and nothing else, and decided that I'd like to be able to control each of the faces of the cubes. What I've done is create an empty GameObject for each cube and then use it as the parent for each of 6 face GameObjects. Doing so has rendered the game unplayably slow. Any ideas?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Eric5h5 · Feb 14, 2013 at 10:30 PM

Because you have 6X the draw calls. You can use a texture atlas instead, so you don't need to have separate game objects and materials for the individual faces.

Comment
Add comment · Show 7 · 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 lumberbunny · Feb 15, 2013 at 03:17 AM 0
Share

Each face is an instance of the same prefab, just rotated 90 degrees. Even if there is no texture applied, it still runs slow. In total, there are only about 1000 GameObjects.

avatar image Eric5h5 · Feb 15, 2013 at 05:13 AM 0
Share

That doesn't change anything about my answer at all.

avatar image lumberbunny · Feb 15, 2013 at 06:21 AM 0
Share

I don't understand. What use is a texture atlas when all of the faces share a single texture, or have no texture at all? And in any case how would a texture atlas obviate the need for separate GameObjects when I want to be able to manipulate each of the faces individually?

avatar image Eric5h5 · Feb 15, 2013 at 06:28 AM 0
Share

Sorry, I assumed by "manipulate each of the faces" you were talking about textures. If you're physically moving the faces around then you're not really using cubes. In that case you should use the $$anonymous$$esh class and change the vertices, so you can have many objects in one mesh, ins$$anonymous$$d of so many separate objects. Or you could use a skinned mesh and bind each face to a bone, and use the bones to move the faces around. That would be less performant than a normal mesh, but easier to manipulate.

avatar image lumberbunny · Feb 15, 2013 at 06:58 AM 0
Share

Excellent. I will definitely look into that.

As someone new to Unity but not to game development, I wonder if you might indulge this question a little further and a little more fundamentally...

Is 1000 GameObjects a lot? Are there structures in Unity better suited for simple actors?

Is there a significant performance penalty for multiple generations of transform parentage? That is, does a visibly indistinguishable GameObject that is composed of children and grandchildren incur performance costs other than additional draw calls?

Is there a significant difference in performance between Transform.Translate/Rotate and assigning to Transform.position/rotation?

Thanks again.

Show more comments

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

11 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

Related Questions

Why is there no gameObject.parent? 1 Answer

Parenting Instantiated objects on Collision 2 Answers

How to instantiate a GameObject in a scene and keep world transform? 3 Answers

transform.parent can't go with gameObject.find 3 Answers

iOS Instantiate transform as child -- positioning bug 2 Answers


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