Particle Systems. Stick inside pooled objects or pool them separately.
Hi! I recently started using particle systems along my walking/running/idle animation states. I want to have a variety of PS for different terrains (think dust for regular ground, splashes if going over water, muddy splashes for mud,etc). So if there's 5 terrain types I've had 5 particle systems per state (which would be variations).
Now, I have the particle systems prefabbed right in the player Object, and I have a script which plays the appropriate system depending on the terrain type. But I'm realizing, I'm going to be using this same system for all my other characters.
Will there be an impact to performance if all the characters carry their own particle systems?
Or should I just pool the PS and position them over the appropriate character?
Ive heard instantiating PS is slow, but, what if the PS are always stored along with the characters? (characters which will be pooled themselves)
I'm concerned because the game will be for Android (and maybe for PC too).
Anyways, any advice will be greatly appreciated.
I've updated the question and title which hopefully makes it clearer. Anyway, I'm new to unity and program$$anonymous$$g so I hope someone can share some insight about my question.
(I only have a few weeks of Unity experience myself)
Having 5 or more PS on each character doesn't sound like a good idea. I think the main question is how many of those PS can be active and visible at the same time. Can you have 20 characters running around and each of them shall have a visible PS?
Well, there rally won't be more than 3 or 4 characters max at a time.
Answer by Alverik · Sep 08, 2016 at 07:08 AM
I got an answer in the Unity forums (by a unity administrator), so I'm posting it here too.
It sounds like the main concern will be memory usage. 5 per character will use more memory than using a pool, so that's something to consider on a mobile platform.
Regarding instantiating, both your scenarios require instantiating the system so it's not really a big difference, plus you are pooling characters so once a character is created the instantiate issue is over.
Essentially you will either have a bunch of deactivated particle systems in a pool or attached to each character.
I would say it makes sense to pool the particle systems but it won't make a huge difference (unless you have a lot of characters!). karl_jones
I use vertex colors and semi lowpoly models and I don't think I'll have many occasions where there'll be more than 2 to 3 or maybe 4 characters max passing by at a time, so I'll just give it a go. If I notice I have the need for more characters (or there's an impact in performance), then I'll just start pooling the particles too.
Anyway, I hope this information is helpful to others too :)