Convert Prototypes To Detail Meshes

Dictionary<int, Mesh[]> ConvertPrototypesToDetailMeshes(TerrainToMeshPrototype[] data, bool calculateHealthAndDryColor, float exportPercentage, int maxVertexCountPerCombinedMesh, float yRotation = 360, float yRotationRandomize = 360, float followTerrainSurface = 0, bool followTerrainSurfaceRandomize = false)

Combines TerrainToMeshPrototypes into one or several detail meshes.

Returned dictionary key is the grass index inside TerrainData.detailPrototypesarrow-up-right array and value holds the combined meshes associated to that index.

calculateHealthAndDryColor - Bakes health and dry colors from TerrainDataarrow-up-right inside combined mesh vertex color.

exportPercentage - Percentage of the combined detail objects in the range of [0.01, 100]

maxVertexCountPerCombinedMesh - Defines how much vertices combined mesh(es) will contain.

Theoretically Unity can create mesh with 4 billion vertices, but for run-time use it is better to use more logical values. Based on the used vertex count, generated meshes will be in 16 or 32 bits index formatarrow-up-right.

Last updated