diff --git a/Source/Engine/Particles/ParticleEffect.cpp b/Source/Engine/Particles/ParticleEffect.cpp index 656a61991..e461f332e 100644 --- a/Source/Engine/Particles/ParticleEffect.cpp +++ b/Source/Engine/Particles/ParticleEffect.cpp @@ -283,11 +283,8 @@ void ParticleEffect::UpdateSimulation(bool singleFrame) void ParticleEffect::Play() { - // Reset simulation when play is called and particle system is time is complete - ex. if IsLooping is false and simulation is complete - if (!IsLooping && Instance.Time >= (float)ParticleSystem->DurationFrames / ParticleSystem->FramesPerSecond) - ResetSimulation(); - _isPlaying = true; + _isStopped = false; } void ParticleEffect::Pause() @@ -297,6 +294,7 @@ void ParticleEffect::Pause() void ParticleEffect::Stop() { + _isStopped = true; _isPlaying = false; ResetSimulation(); } @@ -452,7 +450,7 @@ void ParticleEffect::Update() void ParticleEffect::UpdateExecuteInEditor() { // Auto-play in Editor - if (!Editor::IsPlayMode) + if (!Editor::IsPlayMode && !_isStopped) { _isPlaying = true; Update(); diff --git a/Source/Engine/Particles/ParticleEffect.h b/Source/Engine/Particles/ParticleEffect.h index 07d82d703..d3f0cc9d0 100644 --- a/Source/Engine/Particles/ParticleEffect.h +++ b/Source/Engine/Particles/ParticleEffect.h @@ -185,6 +185,7 @@ private: Array _parameters; // Cached for scripting API Array _parametersOverrides; // Cached parameter modifications to be applied to the parameters bool _isPlaying = false; + bool _isStopped = false; public: /// diff --git a/Source/Engine/Particles/Particles.cpp b/Source/Engine/Particles/Particles.cpp index 15d484f8a..52845a0f8 100644 --- a/Source/Engine/Particles/Particles.cpp +++ b/Source/Engine/Particles/Particles.cpp @@ -1318,8 +1318,8 @@ void ParticlesSystem::Job(int32 index) emitterInstance.Buffer = nullptr; } } - // Set is playing to false because it is not playing anymore. - effect->Pause(); + // Stop playing effect. + effect->Stop(); return; } }