- Home /
Adding a script to a particle (not particle system)
Hello,
I would like to create a particle system that shoots particles that damages a player when it hits a player. My question is:
Is there a way to attach a script to a particle?
If not, is there a way to make particle system shoot an object with a script attached?
Thanks!
Answer by brilliancenp · Feb 27, 2014 at 07:13 PM
A 'Particle' is not an object it is a simple struct so there is no way to attach a script to it directly. By attaching a script to a particle system you can control each particle individually using the particle's attributes and have a means of doing what you normally would through attaching a script to an object. I do this often and have found, while a bit tedious at times, it is the only way to work within the access that Unity gives you to the particle system.
There is no way a ParticleSystem object can shoot anything but a particle.
Answer by iamvishnusankar · Feb 15, 2014 at 02:38 AM
Check this.
I watched it before posting this question. it just goes over module. :(
Answer by TooManySugar · Jan 17, 2017 at 10:45 PM
I was looking for the same info.
I think what u're looking for is this:
https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnParticleCollision.html
"Description
OnParticleCollision is called when a particle hits a Collider.
This can be used to apply damage to a GameObject when hit by particles."
Your answer
![](https://koobas.hobune.stream/wayback/20220613133544im_/https://answers.unity.com/themes/thub/images/avi.jpg)