blog games developers documentation portfolio gallery

Documentation:

SetUpLODLevels AndChildrenWith LODSwitcher()

Mesh[] GameObject.SetUpLODLevelsAndChildrenWithLODSwitcher(float[] lodScreenSizes, float[] maxWeights, bool recalcNormals, float removeSmallParts)


Generates compressed LOD meshes just like SetUpLODLevelsWithLODSwitcher().

The difference with SetUpLODLevelsWithLODSwitcher() is that it also creates new child gameObjects for every LOD level. It still adds a LODSwitcher component to this gameObject, but instead of setting up an array of LOD meshes, it sets an array of LOD gameObjects.

This can be useful for when you also want to remove certain components or childObjects for the LOD gameObjects. Or when the original mesh was too big and had to be split into two groups, the meshes of LOD 1 may be small enough to be merged together. This is only possible when you use gameObjects per LOD Level.

This function returns an array with the newly generated LOD Meshes plus the original mesh which is used for level 0.

recalcNormals is a bool that is best set to true unless your original mesh has specific normals that should be left alone.






follow us