diff --git a/Runtime/Scripts/Effects/UIParticleSystem.cs b/Runtime/Scripts/Effects/UIParticleSystem.cs index 6bd1897..2cf6b53 100644 --- a/Runtime/Scripts/Effects/UIParticleSystem.cs +++ b/Runtime/Scripts/Effects/UIParticleSystem.cs @@ -223,9 +223,10 @@ namespace UnityEngine.UI.Extensions frame = Mathf.FloorToInt(frameProgress * textureSheetAnimation.numTilesX); int row = textureSheetAnimation.rowIndex; - // if (textureSheetAnimation.useRandomRow) { // FIXME - is this handled internally by rowIndex? - // row = Random.Range(0, textureSheetAnimation.numTilesY, using: particle.randomSeed); - // } + if (textureSheetAnimation.rowMode == ParticleSystemAnimationRowMode.Random) + { // FIXME - is this handled internally by rowIndex? + row = Mathf.Abs((int)particle.randomSeed % textureSheetAnimation.numTilesY); + } frame += row * textureSheetAnimation.numTilesX; break; @@ -234,7 +235,7 @@ namespace UnityEngine.UI.Extensions frame %= textureSheetAnimationFrames; particleUV.x = (frame % textureSheetAnimation.numTilesX) * textureSheetAnimationFrameSize.x; - particleUV.y = 1.0f - Mathf.FloorToInt(frame / textureSheetAnimation.numTilesX) * textureSheetAnimationFrameSize.y; + particleUV.y = 1.0f - ((frame / textureSheetAnimation.numTilesX) + 1) * textureSheetAnimationFrameSize.y; particleUV.z = particleUV.x + textureSheetAnimationFrameSize.x; particleUV.w = particleUV.y + textureSheetAnimationFrameSize.y; }