Run-time API

Convert Vertex Color To Texture method can be brought into scope with this using directive:

using AmazingAssets.ConvertVertexColorToTexture;

Now mesh class will have ConvertVertexColorToTexture extension method, baking mesh vertex color into a texture.

Texture2D ConvertVertexColorToTexture(int submeshIndex, 
                                      int resolution, 
                                      bool hasMipmaps)

submeshIndex

Index of a sub-mesh this texture is generated for. Value of -1 combines all sub-meshes and generates one texture.

resolution

Generated texture resolution.

hasMipmaps

Does generated texture has mipmaps or no.

Convert Vertex Color To Texture shader needs to be in the Always Included Shaders array of the Graphics Settings, when using run-time method in the build:

Last updated