I have a component script that create and setup a quad and store it in the MeshFilter.SharedMesh of the gameobject ( since we are allowed to use mesh directly ).If I have this component attached to a gameobject and I copy / paste the gameobject in the editor both gameobject will share the same mesh, but I would like each instance to have their own mesh so I could set different parameter for each of them.
you just have to call MeshFilter.mesh on each copied gameobject for it to create a duplicated mesh instance of the mesh. You don’t even have to assign it, just the call is enough to have a duplicate created and used instead of the original.
Hello, Thanks for your answer.
When I use mesh it works perfectly but unity raise an error saying that I’m leaking mesh and I should use SharedMesh instead, do you know how to get ride of that ?