Skip to main content

RendererGroup

A class in Root.Township, the global namespace.

A group of renderers changed together: layer, shadows, alpha and material floats. Enabling or disabling the component shows or hides them all (not on a headless server).

Constructors​

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

Fields​

5 private and internal fields
MemberWhat it is
private float albedoAlphaBacking field for AlbedoAlpha, the alpha last applied to the materials.
private bool isInstancedTrue once the renderers have their own material instances.
private int layerBacking field for Layer, the layer last applied to the renderers' objects.
private bool receiveShadowsBacking field for ReceiveShadows.
private ShadowCastingMode shadowCastingModeBacking field for ShadowCastingMode.

Properties​

MemberWhat it is
float AlbedoAlpha { get; set; }Sets the alpha of every renderer's shared material colour, hiding renderers below 0.01. Ignored while the component is disabled.
int Layer { get; set; }Sets the layer on every renderer's GameObject.
bool ReceiveShadows { get; set; }Sets shadow receiving on every renderer.
ShadowCastingMode ShadowCastingMode { get; set; }Sets the shadow casting mode on every renderer.

Methods​

MemberWhat it is
void SetAsMaterialInstances()Gives each renderer its own material copy, so later changes do not affect other objects. The copies are cleaned up on destroy.
void UpdateMaterialFloat(string floatName, float value)Sets a float on the shared material of every enabled renderer, by name or property id.
void UpdateMaterialFloat(int floatID, float value)Sets a float on the shared material of every enabled renderer, by name or property id.
5 private and internal methods
MemberWhat it is
private void Awake()If the component starts disabled, hides the renderers as OnDisable would.
private void OnDestroy()Cleans up the per-renderer material instances if SetAsMaterialInstances made them.
private void OnDisable()Hides every renderer in the group. Does nothing on a headless server.
private void OnEnable()Shows every renderer in the group. Does nothing on a headless server.
private void IReferenceRenderer.UpdateRenderers(Renderer[] oldFirstRenderers, Renderer[] newFirstRenderers)Swaps the old first-LOD renderers in the group for the new ones.

Used in​

Members of other types that take, return or hold a RendererGroup: