How to enable/Disable/enable the Particle System Component of a child object on the same object/Parent? (Solved)

I can officially say there ‘is’ such a thing as information overload, geez I must have read about 40 topics/answers now and I’m still no clearer to solving my issue.

I have a particle System attached to a child object of my player (hierarchy wise that’s Player/MainCamera/BoostEffectObject/ParticleSystem

My script is on the player object (parent of the child object)

I think (please correct me if wrong) that I need this to initialise-

void Awake()
		boostSparkle = GetComponentInChildren<ParticleSystem>();

and then I have this in my OnTriggerEnter function -


But I’m getting this error -

“Assets/Scripts/SpeedBoostActivate.cs(32,38): error CS1061: Type UnityEngine.Component' does not contain a definition for SetActive’ and no extension method SetActive' of type UnityEngine.Component’ could be found (are you missing a using directive or an assembly reference?)”

I’ve tried different variations and variations using enabled but everything seem to give a compiler error.

Suggestions please guys


You have a reference to the particlesystem, not the gameobject, and particlesystem has no SetActive method.
Instead, use bootSparkle.gameObject.SetActive(true) to activate the gameObject.
Alternatively, you could just have the gameObject active, disable the emission, and in your code call bootSparkle.enableEmission = true.

I had the same issue, so created empty game Object and placed particles in there

Then just the enabled/disabled the game Object