- Home /
Is it possible to attach extra variables to a particle via a script?(such as damage done)
I'm trying to make a game with somewhat realistic ballistic physics and I want to know if/how it's possible to attach something such as a damage value that's accessible by a receiver (a character that is hit). I'm using the shuriken particle system right now.
It should be possible to create a particle data class that contains a reference to the particle and the other information you need.
Not sure if it can actually be attached to an individual particle, but you could manage everything from the particle system.
hi. i know this thread is quite old, but i need the exact same thing. I looked desperately all over the internet and nobody seems to have / understand this problem. This is the only thread that asked the right question. also screenname_taken doesn't seem to understand the problem. I do NOT want to calculate the damage by velocity, I do NOT want to hack the value into some unused property like startSpeed and I can NOT put the value on the caster, since it's possible that it changed between cast and hit. Since your original post is more than a year old: have you found any solution to yourself? Any help appreciated.
Answer by screenname_taken · Aug 19, 2014 at 10:49 PM
I have looked at the docs, but I haven't found anything alluding to the possibility of sending custom variables with the particle for a particle collision. I was thinking that maybe there's a way around it, such as attaching a script to the particle system and maybe backtracking from the collision event to the particle system and taking the script component and thereby getting access to the damage variable
I lost you a bit there. What do you mean custom variables? The second script at the link i've sent you shows how you can use a script, Shuriken particles and a collider, that in the even of particle collision something happens. What happens is up to you.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
best free fps assets 2 Answers
How do i get a weapon to follow the first person controller up and down? 0 Answers
Unity FPS question 0 Answers