Skip to main content

DynamicObjectCombiner

A class in Root.Township, the global namespace.

A StaticObjectCombiner for moving objects: it keeps results off the terrain layer, skips listed renderers, and can add the combined renderers to a RendererGroup.

Constructors​

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

Fields​

3 private and internal fields
MemberWhat it is
private RendererGroup addResultsToOptional renderer group that gets the combined renderers.
private Transform avoidChildRenderersOfRenderers under this transform are left out.
private Renderer[] renderersToAvoidRenderers left out of the combine.

Properties​

MemberWhat it is
protected override bool IsCleaningOnJoin { get; }Always false.
protected override bool IsSettingToTerrainLayer { get; }Always false, so results stay on their own layer.

Methods​

MemberWhat it is
override void Bake()Combines meshes like the base, listening for the created renderers to add them to addResultsTo.
protected override bool ValidateRenderer(Renderer renderer)Rejects renderers under avoidChildRenderersOf or in renderersToAvoid, then defers to the base check.
2 private and internal methods
MemberWhat it is
private void AddRenderers(IEnumerable<Renderer> renderers)Adds the newly combined renderers to addResultsTo.
private void OnValidate()Turns off the terrain-occludes-triangles function, which does not suit moving objects.