- Home /
difference between sharedMesh and Mesh
What is the difference between the two? Why is it that .mesh is always warned in danger of deprecation, and not sharedMesh? Does this have to do with batching?
Answer by Mike 3 · May 08, 2011 at 10:00 PM
In the case of MeshCollider which I assume you're talking about, there's no difference in the implementation at all anymore. mesh has been deprecated (made obsolete) and shouldn't be used anymore, and it just calls sharedMesh internally.
In the case of MeshFilter (and SkinnedMeshRenderer), calling mesh will cause an instance to be created if it hasn't already done so, allowing you to modify the mesh without manipulating all the other instances. sharedMesh (which isn't deprecated for these classes) doesn't creae a new instance, which is generally what you want to use when reading from the mesh and not modifying.
In the latter case, why is it deprecated? It seems shared$$anonymous$$esh and mesh will leave totally different results for $$anonymous$$eshFilter...
It's not deprecated for $$anonymous$$eshFilter, only $$anonymous$$eshCollider.
I noticed in procedural manipulations to a single mesh, .shared$$anonymous$$esh will modify all instances of the mesh - so it seemed like totally different results. Why is it deprecated in $$anonymous$$eshCollider? Do all instances share the same collider, even if they have different geometry? Is there a way to instantiate ones with different meshcolliders?