Skip to main content

EffectReleaseOnFade

A class in Root.Township, the global namespace.

Pooled effect that, when released, stops its particle systems and sound and waits for the longest particle duration before going back to the pool.

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private SoundSource audioToFadeSound source played on request and stopped on release.
private Coroutine fadeCoroutineThe fade coroutine in progress. If a fade is cut short, a later Release only stops the old handle and does not release.
private bool hasAudioSerialized flag that nothing reads in this build.
private bool isReleasingTrue while the fade-out is running.
private ParticleSystem[] systemsToFadeParticle systems stopped on release.
private bool unparentingOnReleaseDetaches the effect from its parent when released, so it can finish fading in place.

Methods​

MemberWhat it is
virtual void PostBake()Build step: removes null entries from systemsToFade.
override void Release()Starts the fade-out instead of releasing at once. Does nothing if already releasing or inactive.
4 private and internal methods
MemberWhat it is
private void Awake()Hooks SetupRequest to the pool's request event.
private void BaseRelease()Returns the object to the pool and clears the fade state.
private IEnumerator FadeAndRelease() (iterator)Coroutine that stops the particles and audio, waits for the longest particle system duration, then releases.
private void SetupRequest(PooledObject pooledObject)When taken from the pool, clears the releasing flag and starts the audio.

Used in​

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