random tile from sprite sheet for each particle?

Is it possible to assign random image from sprite sheet (lets say 3x3 images) to each particle?
I know how to do an animation from it, but how do i just assign a random one and not change it over time?
Thanks

3 Likes

Currently, the only way to get different mixed particles seems to be running multiple particle systems with appropriate texture offsets for each. That, or use a custom solution not relying on Unity’s particle systems.

is 10 emitters emitting 5 particles each the same as one emitter emitting 50 particles, performance wise? if its roughly the same then thats my solution…

I assume it would be roughly the same. Give it a try and see if performance is still good.

I know this thread is a couple of years old, but there is a solution to this problem that I’d thought I would share. I’m using the Shuriken particle system in Unity 4.3.

Arrange your sprites in a vertical column. Under the “Texture Sheet Animation” section of your particle system, input the number of rows (ie number of sprites) and choose random row. Like such:
1466699--80355--$Screen Shot 2013-12-28 at 5.38.36 PM.png
Hope this helps someone.

22 Likes

Thank you nomadic, that helped me :slight_smile:

Hello I have a similar problem with my Texture sheet animation. Currently i have a long column of textures each in there own row 16 to be exact. When i set the tiles and click the Random Row. It sets all my particles to only one texture. No random at all. These are the settings i have.
Tiles X 1, Y 16
Animation Single Row
Random Row Checked
Frame over Time 0
Cycles 1

e_c_agile, sorry for the misleading screencap-- you need to set Frame over Time to specify the speed at which your frames will change.

1 Like

nomadic, even if i set the frame over time to 1, i am still getting the same starting frame for all my particles. It still is not setting a random row. Any idea on what it might be? Also the texture sheet i am using is a 512 X 8192 if that helps?

I’m not sure if it is causing the problem, but yes, 8192px is too large. I think Unity is going to compress it to 4096 anyways. Think about how much of your entire screen a particle will fill on average. Unless you have a very unusual use case, your particles will not consistently be taking up 512x512 of your screen.

1 Like

Old thread but set your Frame over time to “Randomize between two constants”.
Set first number to 0 and other to (nth) frame

11 Likes

If you auto emit particles you may have to do something like

particle.randomSeed = (uint)++i;

1 Like

Thank you Nomadic. Your solution still works for Unity 2020.3.15f :slight_smile: