From d4a1f74680bab2af67a594bcc32f7310c9c46f2b Mon Sep 17 00:00:00 2001 From: Evandro Lins Date: Fri, 1 Jan 2021 20:54:54 -0300 Subject: [PATCH] Update ParticleSystemControlMixer.cs Added an override to OnGraphStop() so the particle would stop emitting when the timeline stops midplay. This is useful in my case because I'm using timelines as states, and not always would wait till the timeline ends. --- .../Runtime/ParticleSystemControlMixer.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Assets/ParticleSystemControl/Runtime/ParticleSystemControlMixer.cs b/Assets/ParticleSystemControl/Runtime/ParticleSystemControlMixer.cs index 8e05781..9490811 100644 --- a/Assets/ParticleSystemControl/Runtime/ParticleSystemControlMixer.cs +++ b/Assets/ParticleSystemControl/Runtime/ParticleSystemControlMixer.cs @@ -191,6 +191,14 @@ public override void ProcessFrame(Playable playable, FrameData info, object play } } } + + public override void OnGraphStop(Playable playable) + { + if (particleSystem == null) return; + + if (Application.isPlaying) + particleSystem.Stop(); + } #endregion }