Skip to main content

DissolvingEffect

A class in Root.Township, the global namespace.

A DestroyByTime pooled object whose renderers dissolve with a shader over its lifetime before it is released. Client visual.

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private Material currentMaterialThis instance's copy of the dissolve material.
private static readonly int dissolveIDShader property ID for _Progress.
private Material dissolveMaterialMaterial to copy for the dissolve.
private AnimationCurve dissolveProgressCurve from lifetime (0 to 1) to dissolve amount.
private bool isDissolvingWhether there are renderers to dissolve; set at build time.
private MeshRenderer[] renderersRenderers that get the dissolve material.

Methods​

MemberWhat it is
protected override void Awake()If dissolving, gives the renderers a copy of the dissolve material and resets it each time the object is taken from the pool.
protected override IEnumerator Destroy() (iterator)Runs the dissolve along dissolveProgress over Time, or just waits, then releases.
1 private and internal method
MemberWhat it is
private void IBuildRendererPostBake.PostBake()At build time, drops null renderers and turns dissolving on only if any are left.