Texture Sheet Animation - Set Row Index for each Particle via Script

Hey,

i’m trying to use one ParticleSystem to emit particles with different styles. All praticles are generates via code and everything works as expected except of the tiling. All particles always have the same Tile which is the last value of the line anim.rowIndex = i % noOfTiles;

The code runs once on Start()

    public void Generate(int noOfObjects, int noOfTiles)
    {
        List<Vector3> spawnLocations = FancyRandomFunction();

        ParticleSystem.Particle[] particles = new ParticleSystem.Particle[noOfObjects];
        ParticleSystem.TextureSheetAnimationModule anim = ps.textureSheetAnimation;        

        for (int i = 0; i < noOfObjects; i++)        
        {
            particles *= new ParticleSystem.Particle();*

particles_.position = spawnLocations*;_
_particles.remainingLifetime = 100f;_
_particles.startSize = 1f;_
_particles.startLifetime = 100f;_
_particles.startColor = Color.white;*_

* anim.rowIndex = i % noOfTiles; // <— alternate RowIndex*
}

ps.SetParticles(particles, noOfObjects);
}
Is there any way to force different tiles for each particle from code?

i found a trick to do this

first particle system inspector set use randomRow = true;

and in code change numTilesY instead rowIndex

public void PlayEmitAllTextureSheet()
    {
        for (int i = 0; i < listParticle.Length; i++)
        {
            //listParticle*.m_Particle.Play();*

for (int j = 0; j < listParticle*.emitCount; j++)*
{
var textureSheetAnimation = listParticle*.m_Particle.textureSheetAnimation;
textureSheetAnimation.numTilesY = j + 1;
_//textureSheetAnimation.rowIndex = j;*_

//Debug.Log(textureSheetAnimation.rowIndex + " " + textureSheetAnimation.numTilesY);
listParticle*.m_Particle.Emit(1);
_}
}
}*_