Trying to get a particle system to play with following code:
GameObject.Find("/Cylinder/Cube/ParticleSystem").Play();
With hierarchy as follows
Cylinder
>Cube
>>ParticleSystem
But get the error
'Play' is not a member of 'UnityEngine.GameObject'
Giving an accurate and specific solution is hard without more information about your setup. First, GameObject.Find() does not take a path. Assuming you execute the code from a parent transform, you can use Transform.Find(). Alternately if there is only one ParticleSystem in the game object hierarchy you outline, you can use GameObject.GetComponentInChildren(). In Javascript/UnityScript:
gameObject.GetComponentInChildren(ParticleSystem).Play();
In C#:
gameObject.GetComponentInChildren<ParticleSystem>().Play();
‘gameObject’ is the game object at the top of your parent/child hierarchy…or at least somewhere above the game object that has the ‘ParticleSystem’ on it.
P.S. If “/Cylinder/Cube/ParticleSystem” is really the name of a single game object, then you just need to add ‘particleSystem’ to your code:
GameObject.Find("/Cylinder/Cube/ParticleSystem").particleSystem.Play():