#playing particle effects
1 messages · Page 1 of 1 (latest)
Do you want it to play as soon as it's created?
If so, you can go the particle effect component in the inspector and check the playOnAwake box https://docs.unity3d.com/ScriptReference/ParticleSystem.Play.html
If not, you need a reference to your particle effect. Say you've stored it in a variable called GreenDeath. Then when you want it to play it, you just call GreenDeath.Play();
No, you have to go back to the Unity editor, leave your IDE. Find the GameObject that your particle effect is attached to (I assume it's a prefab). Under the particle effect component settings, search around until you find the playOnAwake checkbox and make sure it's checked
Then it's playing when it's created. You may just not be able to see it
Try calling GreenDeath.Play()
Yeah your particle effect is not looking like you're expecting then. If that code compiles and runs, then the particle effect is playing. It's just likely off camera because you're not assigning a position when instantiating.
I would pass in more parameters to the Instantiate function.
Try
Instantiate(GreenDeath, _rigidbody.transform.position, _rigidbody.transform.rotation);
Because right now you're only passing a transform which sets the parent of the particle effect but not the actual position. So it could be anywhere, including off camera
Because you only have two parameters, it's interpreting that you are trying to use a different method signature. You need to add a third parameter, rotation (see my post above) for the compiler to recognize that you want to use the intended method signature.