Modifying VertexColor Warning.

Hello!

I’ve created a script which lets me edit the color of the vertices in a mesh in the Unity3d Editor in EditMode.
To address the vertices and colors, I use:

    var mesh : Mesh = target.GetComponent(MeshFilter).mesh; // error here
    var vertices : Vector3[] = mesh.vertices;
	var colors : Color[] = new Color[vertices.Length];

Unity complains with this:

Instantiating mesh due to calling MeshFilter.mesh during edit mode. This will leak meshes. Please use MeshFilter.sharedMesh instead.

I’ve searched unityAnwers for this Warning and found this thread.
It says meshes would only exist in the scene and not the project.

I want the mesh vertex colors to be independent from every other instance of the mesh, since sharedMesh cause every mesh vertex colors to be the same.

So is it a problem to ignore that warning?

If no problem, is there a method I can disable the warning in that script?

Warnings exist for a reason and shouldn’t be ignored. What you can do is create a new instance of the mesh in the project, and use sharedMesh with that.