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 /
avatar image
3
Question by waterdog · Jan 19, 2018 at 04:13 AM · script.verticesmesh renderer

How do you set mesh.indexFormat?

I don't believe in stupid questions, but, this one could be highly simplistic...;^)

I see with Unity 2017 the mesh indexFormat property can be set to UInt32 to increase the maximum number of vertices allowed in a mesh. It isn't too clear in the docs. How do you actually set that in a C# script?

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

1 Reply

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

Answer by saschandroid · Jan 19, 2018 at 08:15 AM

 Mesh mesh = new Mesh();
 mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
Comment
Add comment · Show 5 · 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 tlskillman · Dec 01, 2018 at 05:49 AM 0
Share

Thanks. The Unity manual doesn't make this very clear.

avatar image sgrein tlskillman · Apr 19, 2019 at 05:10 PM 0
Share

$$anonymous$$h, I think it's fine - I'm just afraid sometimes that it's outdated because there is so many new Unity versions. :)

avatar image sgrein · Apr 19, 2019 at 04:50 AM 0
Share

Unity 2019 manual says that the default is UInt16. Is this true? https://docs.unity3d.com/ScriptReference/$$anonymous$$esh-indexFormat.html

avatar image Bunny83 sgrein · Apr 19, 2019 at 02:03 PM 0
Share

Uhm, yes. Unity always used 16 bit index buffers in the past. There wasn't even an option to change it. That's why we were limited to 64k vertices per mesh. Now since they added support for 32 bit index buffers a mesh can have up to 4 billion (short scale or 4 milliard in the long scale). However the default is still 16 bit. Both to be backwards compatible and to be more efficient since 16 bit index buffers are just half the size. When importing meshes inside Unity with more than 64k vertices Unity should automatically create a mesh with a 32 bit index buffer.

avatar image sgrein Bunny83 · Apr 19, 2019 at 05:04 PM 0
Share

Hey Bunny83. Thanks.

I'm creating my meshes procedural:

 $$anonymous$$esh mesh = new $$anonymous$$esh();
 Vector3[] meshVertices = vertices.ToArray();

I was pretty sure I created a mesh with > 64k vertices yesterday and was not forced to set the IndexFormat to UInt32 - $$anonymous$$aybe I was wrong and the vertice were less. :) That problably has to be the case (Unity 2019).

Best wishes, SG

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

79 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

Related Questions

How do I get rid of intersecting vertices between two gameobjects? 0 Answers

Edit SkinnedMeshRenderer 1 Answer

ECS RenderMesh not visible 1 Answer

Find closest point in triangle to point? 1 Answer

Unity creates a cube like collider when selecting "convex" for a complete different looking mesh created with MeshFilter. How can I fix this? 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