I’m trying to use particle effect as a spell/magic to attack enemies, by using OnParticleCollision(GameObject）method in script. I found that it works just fine when i implemented it to attack single enemy gameobject, but when i tried to apply it to create an AOE spell, it didn’t work, it applied damage to only one enemy in the attack area randomly. Is there any possible way to make particle collision apply damage to multiple targets within the spell attack range? is OnParticleCollision function too expensive for an spell/magic attack? Is physic.overlapsphyere a better solution? Is there any better method to implement AOE damage effect? Thank you!
If your attack is AoE, why are you using ParticleCollision? I mean I get that it is more precise, but I don’t think it’s worth using over a single collider bound to your character. Any kind of physics is very expensive, I can only imagine something that checks for collision of innumerable small bodies. Now unless that AoE attack is very high precision (like, involves stacking hits or something like that), it would be better to just use a circle or sphere collider. If you want to optimize it even further and need a sphere collider, you don’t even need to use colliders - you could just check if the distance between the center of the spell to the enemy is smaller than the distance between the center of the spell and its outer edge.