When a shotgun fires a group of pellets, and let's say 1 or 20 pellets hit the target: how do I call a function only once per accurate shot, instead of once per pellet collision?
When using OnCollisionEnter on the projectile or on the target itself, the method gets called for each individual pellet collision.
Should I use an event for this problem? How would I do this?
Edit: Ah, I forgot to edit this once I figured it out. I think some people might've misunderstood my problem.
If anyone ever stumbles upon this, the way I've done it is by generating a unique ID for each shot of a weapon, and assigning it to each projectile inside that shot. Then any projectile that hits the target will check if that unique ID has called the method yet or not. So this way when you fire 1 shot which has 20 projectiles, each projectile that hit the target will do damage to the target, but only knock it back once, no matter how many projectiles hit.