fix: scaling ParticleSystem puts prewarmed particles in wrong location

close #235
pull/289/head
mob-sakai 2023-08-14 16:03:08 +09:00
parent 425aad0cba
commit fb31db47f2
1 changed files with 7 additions and 4 deletions

View File

@ -178,15 +178,18 @@ namespace Coffee.UIExtensions
gameObject.layer = parent.gameObject.layer; gameObject.layer = parent.gameObject.layer;
_particleSystem = particleSystem; _particleSystem = particleSystem;
_prewarm = _particleSystem.main.prewarm;
#if UNITY_EDITOR #if UNITY_EDITOR
if (Application.isPlaying) if (Application.isPlaying)
#endif #endif
if (_particleSystem.isPlaying) {
if (_particleSystem.isPlaying || _prewarm)
{ {
_particleSystem.Clear(); _particleSystem.Clear();
_particleSystem.Pause(); _particleSystem.Pause();
} }
_prewarm = _particleSystem.main.prewarm; }
_renderer = particleSystem.GetComponent<ParticleSystemRenderer>(); _renderer = particleSystem.GetComponent<ParticleSystemRenderer>();
_renderer.enabled = false; _renderer.enabled = false;