Skip to main content

PlatformLODController

A class in Root.Township, the global namespace.

Build-time bake step that trims a LODGroup to a range of levels on a given platform and deletes the renderers it no longer uses.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private bool destroyEmptyObjectsWhether to delete objects left with nothing on them.
private LODGroup lodGroupThe LOD group being trimmed.
private static Logger loggerNLog logger for this class.
private PlatformLODController.PlatformDetails[] platformDetailsMin and max LOD to keep per platform. A max of 100 means not set up.

Methods​

MemberWhat it is
override void Bake(bool isSaving)For the first matching platform, points reference renderers at the new first LOD and trims the group.
2 private and internal methods
MemberWhat it is
private void BakeToLevel(LOD[] lods, PlatformLODController.PlatformDetails level)Keeps only LODs from min to max, keeps the last transition height, and removes unused renderers. Warns if max was never set.
private void RemoveRenderers(IEnumerable<Renderer> renderers)Destroys the renderers with their mesh filters and vertex streams, and empty objects left behind if set to.