• 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
Question by Case23 · Jul 09, 2010 at 02:03 PM · meshcombinemeshes

Mesh.CombineMeshes Problem. Are there limitations?

I try th combine 15000 cube Meshes into one single Mesh.

I do it like this:

// i have a Dictionary of cubes which i reference to some information, // and contains 15000 cubes public Dictionary<string, GameObject> cubes; // i also have an Mesh created in the Start() function public Mesh mesh = new Mesh();

CombineInstance[] combineMeshes = new CombineInstance[cubes.Values.Count]; int count = 0; foreach (GameObject c in cubes.Values) { MeshFilter mF = c.GetComponent<MeshFilter>(); combineFileMeshes[count].mesh = mF.mesh; combineFileMeshes[count].transform = c.transform.localToWorldMatrix; count++; }

mesh = Mesh.CombineMeshes(combineMeshes); mesh.Optimize();

After i did this, the cubes existed, and the cubes in the mesh should look the same. But they dont. Are there limitations how many objects you can combine in a single Mesh?

Comment

People who like this

0 Show 1
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 Case23 · Jul 09, 2010 at 03:26 PM 0
Share

It realy looks like there are limitations. I tryd to use two Meshes, which both only holds 10000 cube meshes, and now i can see much more, but still not all.

1 Reply

  • Sort: 
avatar image
Best Answer

Answer by jonas-echterhoff · Jul 09, 2010 at 03:44 PM

Meshes in Unity cannot have more then 65536 vertices, because indices are 16 bit numbers internally. So, given that your cubes have 8 vertices each, you cannot have more then 8192 cubes in one mesh (does not matter if it is created using Mesh.CombineMeshes or by other means).

Comment
Tetrad
Case23
Noise crime
Fattie
Angryr
Novack
abelevtsov
jaxsonmyrick
Kossinna

People who like this

9 Show 3 · 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 Case23 · Jul 09, 2010 at 05:28 PM 0
Share

Thanks again jonas! Perfect Answer!

avatar image Steven-1 · Jan 08, 2013 at 01:52 PM 0
Share

I recently noticed I managed to create meshes in code with more than 100000 vertices each. I guess the limitation has been removed? (I'm using the latest unity 3 version btw)

avatar image jaxsonmyrick · Jul 29, 2018 at 05:16 AM 0
Share

I was making a mesh and I learned the limit is smaller than 8192 cubes. It is actually 2730 cubes because cubes must have 24 vertices and not 8 (source: https://answers.unity.com/questions/143109/why-does-a-primitive-cube-contain-24-verts.html) Basically, each face must have 4 unique vertices for normals for lighting. I was making a 3000+ cube mesh and was puzzled. I'm happy to contribute to the discussion for once :)

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Combining meshes clears old mesh 0 Answers

Combine meshes at runtime without all mesh as children of mesh 0? 1 Answer

Why is raycast not working with mesh collider 0 Answers

How to remove internal triangle/faces when combining mesh 0 Answers

500K upper bound on total number of meshes? 0 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