blog games developers documentation portfolio gallery


SetUpLODLevels AndChildren WithLODGroup()

Mesh[] GameObject.SetUpLODLevelsAndChildrenWithLODGroup(float[] relativeTransitionHeights, float[] maxWeights, bool recalcNormals, float removeSmallParts)

Generates compressed LOD meshes just like SetUpLODLevelsWithLODSwitcher(). But it does this for all MeshFilters in the children.

It then creates new gameobjects including children for every LOD level. These new gameObjects, including this orginal gameObject are then added to a new parent gameObject.
The parent will have an LODGroup component added to it.

This function returns an array with the all newly generated LOD Meshes plus the original meshes which are used for level 0. So the number of meshes in this array can be greater than the number of LOD levels, when the gameObject has children.

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

follow us