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
2
Question by Moohasha · May 16, 2012 at 02:33 AM · buggizmos

Gizmos.DrawCube bug? Doesn't like lots of calls.

I've noticed that whenever Gizmos.DrawCube is used a lot, it stop drawing cubes and starts drawing a bunch of random lines. See screen shots below. Through some testing I've discovered that the magic limit is 1365. For example, if I make a grid of 10x100 cubes (1000 total), they all draw correctly. But if I try to draw a 10x100 grid of cubes, they start getting messed up. Is this a bug?

(10x100 cubes, everything's okay) alt text

(100x100 cubes, barf...) alt text

DrawCube_good.png (313.1 kB)
DrawCube_bad.png (246.1 kB)
Comment
Add comment · Show 3
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 syclamoth · May 16, 2012 at 04:44 AM 0
Share

Do you get any error messages that come along with this?

avatar image Moohasha · May 16, 2012 at 12:24 PM 0
Share

Nope, no error message.

avatar image Moohasha · May 16, 2012 at 12:32 PM 0
Share

By the way, in the mean time I've avoided the problem by using DrawWireCube ins$$anonymous$$d of DrawCube.

1 Reply

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

Answer by Berenger · May 16, 2012 at 04:37 AM

This might be due to Unity's max vertex count per object, which is 2^16 (65536) and 100*100 cubes is 10 000 * 8 vertex, 80 000. If this is incorrect, I'll move my answer to the comments.

Comment
Add comment · Show 4 · 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 Moohasha · May 16, 2012 at 12:30 PM 0
Share

That actually makes sense. The lines seem to be pointing to other vertices than the ones they should, suggesting that after a point the indices are getting messed up. Good thought. Any way to break gizmos out into multiple objects to avoid this problem?

avatar image Berenger · May 16, 2012 at 02:53 PM 0
Share

I'm not sure if unity is packing every gizmos in the scene into one mesh or if it's only for one object drawing gizmos. I though about that because of Aron Granberg's path finding tools, where the grid was all messed up when you had too many nodes. $$anonymous$$aybe he found a way around.

avatar image Moohasha · May 17, 2012 at 01:55 AM 0
Share

Yeah, I've noticed that with the same path finding extension. =P I finally just commented out the lines in that where the unwalkable nodes were drawn because it was driving me crazy.

avatar image Bunny83 · May 17, 2012 at 02:11 AM 2
Share

The gizmos are pertty sure all packed into one mesh, otherwise you would have real performance issues.

Btw a cube needs 24 vertices since you need a seperate vertex normal for each face. So 4 vertices and 2 triangles per face. One cube needs 36 indices (6faces == 12 triangles)

Unity's mesh class is actually clamped to exactly 65000 indices. That would be ~1500 cubes, but don't forget all the other default gizmos ;)

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

6 People are following this question.

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

Related Questions

Gizmos stopped showing up for Gameobject unless it is rotated 180 degrees on Y axis 1 Answer

Hi,a Problem When I Save a Prefab 0 Answers

Unity crashes on selection of prefab in project tab 0 Answers

Character refuses to turn 0 Answers

Coroutines Bug? Unity 4.5 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