Skip to main content

CreateLOD

A class in Root.Township, the global namespace.

Editor tool: when isGoing is ticked in the inspector, it builds a LODGroup from the lods prefabs plus a mesh-collider copy of LOD 0, then removes itself.

Constructors​

MemberWhat it is
CreateLOD()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

2 private and internal fields
MemberWhat it is
private bool isGoingInspector toggle that triggers the build.
private GameObject[] lodsPrefabs to instantiate as LOD 0, 1, 2 and so on, with transition heights spread from 0.8 down to 0.01.

Methods​

2 private and internal methods
MemberWhat it is
private void DestroyEditor(Object target)Meant to destroy an object in the editor; empty in this build, so nothing is removed.
private void OnValidate()Does the LOD build when isGoing is set and no LODGroup exists yet, then clears isGoing.