other enemies attack when they see one of them be killed by the player

I try to make all enemies convert to an attackMode (a boolean) when one is killed. For that I need my enemy script to know when an other enemy is killed close enough (under a rayCast number). Do you have any idea on how I can do that ?
Thank you :slight_smile:

One option would be to make an enemy manager script. In the script, you can have a list of all the enemies. So when an enemy dies, it calls a function in the manager script with the death position as an argument to check all the enemies to see if they are close enough and then alert the ones that are. Just make sure if you are spawning enemies to add them to the list on spawn and remove them on death, after the alert processing of course. Hope that helps!

Second option without the use of manager would be that Enemy.cs (or whatever you call your actor script)
would have Die() Method in it it would call Physics2D.OverlapCircleAll for 2d or Physics.OverlapSphere for 3d.
Get all those enemies in range of that overlap radius(use layermask so it doesnโ€™t care for not-enemy-colliders), loop through those that were found, and set those booleans.

Okay thanks a lot, Iโ€™m going to try that ! :smiley: