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 Jeremy Burgess · Dec 24, 2010 at 09:50 AM · editormeshproceduralpreview

Why does the Unity Editor display full mesh after I've programmatically removed vertices?

First - the situation: In an editor script I am performing a preprocessing step on a mesh in a scene to remove polygons that will never be rendered. To do this I:

  • Figure out what triangles will possibly be visible within a mesh.
  • Make a new mesh and assign it to the sharedMesh on the object I'm examining.
  • Fill out a new set of vertices, normals etc that contain only the visible vertices.
  • Fill out all submesh sets of triangles that are in the visible subset on the new mesh.

While both the editor and game now only render the polygons I've left around, selecting the modified gameobject then shows the original mesh (highlighted in green as normal) rather than the reduced one. If I examine the mesh in the asset window, it does correctly show the reduced mesh, and it has the correct vertext count and so on.

My question then is, why is Unity still displaying the original mesh when I select the relevant Game Object? Is there some link to the original asset from which the mesh came which I can't see? If that is the case, to truly create a reduced mesh, would I need to actually save out a new asset and create a totally new mesh based on that?

Comment
Add comment · 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 Jesse Anders · Dec 24, 2010 at 05:15 PM 0
Share

I don't know the answer for sure (hence this comment rather than an answer), but I suspect that you'd need to write out the mesh as a new asset. (For what it's worth, there's a 'create plane mesh' script on the wiki that shows how to do this.)

1 Reply

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

Answer by Bunny83 · Dec 28, 2010 at 05:04 AM

My guess is that you use a Meshcollider (the green lines are colliders). The Meshcollider component have also a link to a Mesh that should be used for collision detection. I'm sure if you set the Mesh variable of your Meshcollider to your new Mesh it should work. ps. Don't forget to call RecalculateBounds() and evt. RecalculateNormals() after changing the geometry.

Comment
Add comment · Show 1 · 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 Jeremy Burgess · Jan 04, 2011 at 07:51 AM 0
Share

Thanks! It was the collider. that was displaying the old mesh.

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

No one has followed this question yet.

Related Questions

Standard Model Problems- after upgrade to 5.6.1 2 Answers

Editor lags when coming out of play mode...? 0 Answers

Displaying precision edges of a mesh at runtime? 0 Answers

Mirror vertices procedurally 2 Answers

Procedural "dripping" mesh? 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