MasterNin ECSAnimator
On this page

18 — Model and animation LOD

Each source uses one selected Animator with a compatible skeleton and one enabled LODGroup. Extra Animator components no longer block conversion: the converter selects an explicit valid path or the first component and warns that the others are ignored. Multiple enabled LODGroups containing exported geometry remain invalid. Unsupported renderer references and effects-only levels/groups are omitted with warnings; retained levels preserve their thresholds and are renumbered. Animation LOD changes evaluation frequency, not skeleton complexity; runtime mesh simplification and cross-fade are unsupported. Read the package manual's unsupported/prohibited operations before adapting the sample.

Open Scenes/Lod.unity and press Play. TownGuard and CrossbowGuard load from Resources and spawn as ECS characters. Use the four distance buttons or slider; the panel reports the actual selected mesh LOD and animation evaluation interval.

Character (including equipment) LOD0 vertices / triangles LOD1 vertices / triangles LOD2 vertices / triangles
TownGuard 1,665 / 1,742 1,189 / 956 680 / 486
CrossbowGuard 1,493 / 1,452 1,049 / 797 642 / 406

LOD1 and LOD2 are real Blender 4.5 LTS decimations of the current meshes, targeting 55% and 28% of the original triangles. Original skeletons, bind poses, material references, UVs and normalized skin weights are retained; this is mesh simplification, not skeleton simplification. The included reduced Unity Mesh assets and Prefabs are ready to use. Blender is only required to regenerate the meshes, not to run or rebake this sample. Original Demos 01–16 keep their existing assets; Demo17 separately demonstrates body and rigid equipment LOD.

Model LOD authoring

Resources/ECSAnimator/18_Lod/TownGuard/TownGuard.prefab and Resources/ECSAnimator/18_Lod/CrossbowGuard/CrossbowGuard.prefab each contain one Animator, one shared skeleton and one enabled LODGroup. Each level owns distinct renderers and mesh assets, including the weapon/shield. All levels are baked together into the character RuntimeAsset. Each <prefab name>_EntityDesc.asset is beside its source; Convert Presets remain in Authoring.

Animation LOD configuration

Animation LOD controls how often the ECS controller and pose are evaluated. It is independent of model selection. The demo uses distance bands below 8 m, 8–16 m, 16–30 m and beyond 30 m, with 1 / 2 / 4 / 8 frame intervals and 0.5 m hysteresis. These are frame intervals, not fixed Hz. The accumulated time is consumed on the next evaluation; a lower frequency does not intentionally slow down animation time. Attachments use the most recent committed pose.

var settings = new CharacterSimulationLodSettings(
    true, 0, 1, 0,       // enabled; character-local distance reference
    8, 16, 30, .5f,     // distance thresholds; hysteresis
    1, 2, 4, 8);        // frame intervals
if (!runtime.TryPrepare(entityDesc, settings, out var prepared, out var error))
    throw new System.InvalidOperationException(error);

The first preparation of a Product Key in a World determines its shared animation LOD policy. Preparing that live product with conflicting explicit settings is rejected. Calling the original overload without settings reuses an existing live policy, or the baked default when first prepared (currently every frame). To change an explicit policy, destroy/release its users and wait until all references have reached Released before preparing again. Do not mutate the serialized asset or override update-budget components every frame.

Enable Animation close-up to switch to an orthographic camera: the same distant characters remain large on screen and use the near model LOD, while animation still uses the distant interval. This makes the independence of the two policies visible. Turn it off to resume perspective distance-based model switching.

Scope and verification

The sample uses two characters to make LOD changes inspectable; it is not a crowd performance benchmark. Geometry reduction percentages do not imply an equal CPU/GPU or frame-rate improvement. Runtime source: Scripts/LodDemo.cs. Loading and UI are MonoBehaviour glue; animation evaluation and rendering remain ECS systems. Equipment in this demo is part of each character's LODGroup; see Demo 17 for independently loaded rigid equipment.