Problem playing ParticleSystem

I don’t know what I’m doing wrong activating a ParticleSystem.
I use:

efecteDestruccio.GetComponent<ParticleSystem>().Play();

and the particle it’s not shown.

Otherwise I check PlayOnAwake ☑ to the particle and in play mode it’s visible perfectly

Any suggestion ?

Thanks! And sorry for my english

Hello @molistroger,

You need to define which component you want to get when using GetComponent, for example in your case efecteDestruccio.GetComponent<ParticleSystem>().Play()
But I would recommend you to use a class variable to save you component and use it everytime you want instead of calling GetComponent when you use it.
Also to be sure that the component exists you can use a temporary variable

ParticleSystem particle = efecteDestruccio.GetComponent<ParticleSystem>();
print(particle); // check if the console displays 'null' or not
particle.Play();

I can make a better explanation if you are very beginner

When is one ParticleSystem, with more children as a particle system how it works?

Thank you very much!!

foreach( ParticleSystem ps in efecteDestruccio.GetComponentsInChildren<ParticleSystem>() )
{
    ps.Play();
}

Thank you very much!!!

I learn a lot with all of you!!