Hi!
My player game object has several dummy children, each one containing a ParticleSystem.
I use them to trigger several effects whenever needed (since attaching several particle systems to one gameobject is impossible I think).
I’m trying to figure out the correct way to do this (c#):
GetComponentInChildren("particle_stars").GetComponent<ParticleSystem>().enabled=true;
I can’t use transform.Find since I have two players that both have the same children, as you can see on the picture.

I might also be approaching this the wrong way…any suggestions?
Thank you!!
Thanks! That's how I was thinking of doing it as well but creating an array every time I need to trigger a particle feels a bit heavy-handed...though I don't really know...
– andreadstIf the array is never going to change then code it like this. private Component[] children; void Start (){ children = GetComponentsInChildren<ParticleSystem>(); } private ParticleSystem GetSystem (string systemName){ foreach (ParticleSystem childParticleSystem in children){ if (childParticleSystem.Name == systemName){ return childParticleSystem; } } return null; } You could go one step further and assign specific references to each particle system if you prefer.
– KiwasiThat's what I'll do, thank you so much :)
– andreadst