Skip to main content

EmissionControl

A class in Root.Township, the global namespace.

Pooled effect that scales the emission rate of a set of particle systems. It turns emission off when released to the pool and back on when requested again.

Constructors​

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

Fields​

MemberWhat it is
protected ParticleSystem[] systemsToChangeThe particle systems whose emission this component scales. Set in the inspector.
1 private and internal field
MemberWhat it is
private EmissionControl.InitialValues[] initialValuesStarting rate over time and rate over distance for each system, captured in SetupSystems.

Methods​

MemberWhat it is
override void Release()Sets emission to zero, unparents the object and returns it to the pool.
void SetEmissionMultiplier(float value)Scales rate over time and rate over distance of every system by the value, relative to their starting rates.
protected virtual void ResetSystems(PooledObject pooledObject)Hooked to the pool's Requested event; restores emission to full (multiplier 1).
protected virtual void SetupSystems()Subscribes ResetSystems to Requested and stores each system's starting emission rates.
2 private and internal methods
MemberWhat it is
private void Awake()Calls SetupSystems to record the starting emission rates.
private void IBuildRendererPostBake.PostBake()Build step: drops null entries from systemsToChange and re-runs SetupSystems if any were removed.

Used in​

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