- Home /
Make a Collection of Game Objects Preform Different Behaviors
My game has an explosion. I want some system to find all game objects within the radius of the explosion and have each of those objects execute its own "was just affected by an explosion" behavior.
Where should I start? For finding all the objects in the radius of the explosion I've been using Physics.OverlapSphere() to get a collection of the colliders affected, but now I don't know how to execute each of those objects' own explosion behavior.
I've been looking into the Unity Events System, but I don't know how to Invoke the event for the objects ONLY affected by the explosion.
Is there a good solution to this?
Answer by btmodz1 · May 11 at 07:46 PM
I think I found something! Consider looking at interfaces. Here's a link to an article I just starting reading that could implement the behavior above.
C# for Unity — Lesson #6: Inheritance and Interfaces
Your answer
![](https://koobas.hobune.stream/wayback/20220613060356im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Restricting horizontal slash attack 0 Answers
physics.OverlapSphere colliders 1 Answer
FPS Tutorial Rocket Launcher 4 Answers
How to cause damage on collision? 1 Answer
How to I calculate damage when using AddExplosionForce? 0 Answers