Skip to content

Commit

Permalink
fix: scaling ParticleSystem puts prewarmed particles in wrong location
Browse files Browse the repository at this point in the history
close #235
  • Loading branch information
mob-sakai committed Aug 18, 2023
1 parent 425aad0 commit fb31db4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Scripts/UIParticleRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,18 @@ public void Set(UIParticle parent, ParticleSystem particleSystem, bool isTrail)
gameObject.layer = parent.gameObject.layer;

_particleSystem = particleSystem;
_prewarm = _particleSystem.main.prewarm;

#if UNITY_EDITOR
if (Application.isPlaying)
#endif
if (_particleSystem.isPlaying)
{
_particleSystem.Clear();
_particleSystem.Pause();
if (_particleSystem.isPlaying || _prewarm)
{
_particleSystem.Clear();
_particleSystem.Pause();
}
}
_prewarm = _particleSystem.main.prewarm;

_renderer = particleSystem.GetComponent<ParticleSystemRenderer>();
_renderer.enabled = false;
Expand Down

0 comments on commit fb31db4

Please sign in to comment.