parent
1d40e24c74
commit
3880484ce5
|
@ -39,6 +39,7 @@ namespace Coffee.UIExtensions
|
|||
private float _prevCanvasScale;
|
||||
private Vector3 _prevPsPos;
|
||||
private Vector3 _prevScale;
|
||||
private bool _isPrevStored;
|
||||
private Vector2Int _prevScreenSize;
|
||||
private bool _prewarm;
|
||||
private ParticleSystemRenderer _renderer;
|
||||
|
@ -146,6 +147,7 @@ namespace Coffee.UIExtensions
|
|||
ModifiedMaterial.Remove(_modifiedMaterial);
|
||||
_modifiedMaterial = null;
|
||||
_currentMaterialForRendering = null;
|
||||
_isPrevStored = false;
|
||||
}
|
||||
|
||||
public static UIParticleRenderer AddRenderer(UIParticle parent, int index)
|
||||
|
@ -581,7 +583,7 @@ namespace Coffee.UIExtensions
|
|||
var isWorldSpace = _particleSystem.IsWorldSpace();
|
||||
var canvasScale = _parent.canvas ? _parent.canvas.scaleFactor : 1f;
|
||||
var resolutionChanged = _prevScreenSize != screenSize || _prevCanvasScale != canvasScale;
|
||||
if (resolutionChanged && isWorldSpace)
|
||||
if (resolutionChanged && isWorldSpace && _isPrevStored)
|
||||
{
|
||||
// Update particle array size and get particles.
|
||||
var size = _particleSystem.particleCount;
|
||||
|
@ -607,6 +609,7 @@ namespace Coffee.UIExtensions
|
|||
_delay = true;
|
||||
_prevScale = scale;
|
||||
_prevPsPos = psPos;
|
||||
_isPrevStored = true;
|
||||
}
|
||||
|
||||
_prevCanvasScale = canvas ? canvas.scaleFactor : 1f;
|
||||
|
@ -640,7 +643,7 @@ namespace Coffee.UIExtensions
|
|||
var rateOverDistance = emission.enabled
|
||||
&& 0 < emission.rateOverDistance.constant
|
||||
&& 0 < emission.rateOverDistanceMultiplier;
|
||||
if (rateOverDistance && !paused)
|
||||
if (rateOverDistance && !paused && _isPrevStored)
|
||||
{
|
||||
// (For rate-over-distance emission,) Move to previous scaled position, simulate (delta = 0).
|
||||
var prevScaledPos = isLocalSpace
|
||||
|
|
Loading…
Reference in New Issue