I’ve been pleased lately to be using Polybrush to paint vertex colors and do some mesh editing nicely in Unity. After doing mesh adjustments lots of objects in our scene have PolybrushMesh components on them and I’ve written an editor script to clean things up. It finds PolybrushMesh components in the scene, saves out just the mesh data we require, and removes the PolybrushMesh components. This way I can efficiently trim duplicated data (using Additional Vertex Stream with Polybrush appears to duplicate all the mesh data) and store it in ways optimal for our game.
But wait - I can’t actually do that as PolybrushMesh is a class marked as internal…(⊙_◎)
Is there no way to interact with PolybrushMesh scripts in my scene? Is there a different workflow I’m supposed to use in order to accomplish what I set out above?
Polybrush does not have a public API. However if you are planning to modify there is a nice feature in Package Manager that allows you to embed packages in your project so that they may be edited.
Actually yes, you don’t really need to access the PolybrushMesh component to modify the vertex streams. You can access that mesh through MeshRenderer.additionalVertexStreams.
On another note, if Polybrush is storing anything other than vertex positions + modified attributes, that sounds like a bug to me.
Right, I do access the mesh data through the MeshRenderer but I first need to find all objects in the scene that have PolybrushMesh (which is a class I can’t reference) components on them in order to process the data and remove the component.
When I read the additional vertex streams I get the full mesh data (vertices, uvs, triangles) when I only modified the vertex colors. That appears to be a full mesh copy.