Change NavMesh Speed after collision/trigger just for 1 object

Hi guys, nice to meet u.

I’m going to tell u my Shakesperian Question.

I have more than 1 enemy with the same Script, and that’s my problem:
My player has a script that stops the enemy for 5 seconds after the Spacebar is pressed and if it is in a specific range. I detected this range creating a GizmoSphere and his radius and using it in my “StopTheEnemy” script with a float variable.If the distance between the player and the enemy is less than the MaxRadius of the gizmosphere, the script change the NavMesh Speed of my enemy to 0. It works with just 1 enemy, and when i try to add more than one, all the enemies stops ( i interact with some variables too in the enemy script ).

So, i know that i wrote with a little caos in so i’ll tell u just my question:
I want to try to change the NavMeshSPeed just for the enemy that collides with my player’s GizmoSphere without change something in other enemies with same script and components. There’s a way to take the component of the collided/triggered object inside the function?

THANK U SO MUCH !

and have a nice day =)
,Hi guys, nice to meet u.

I’m going to tell u my Shakesperian Question.

I have more than 1 enemy with the same Script, and that’s my problem:
My player has a script that stops the enemy for 5 seconds after the Spacebar is pressed and if it is in a specific range. I detected this range creating a GizmoSphere and his radius and using it in my “StopTheEnemy” script with a float variable.If the distance between the player and the enemy is less than the MaxRadius of the gizmosphere, the script change the NavMesh Speed of my enemy to 0. It works with just 1 enemy, and when i try to add more than one, all the enemies stops ( i interact with some variables too in the enemy script ).

So, i know that i wrote with a little caos in so i’ll tell u just my question:
I want to try to change the NavMeshSPeed just for the enemy that collides with my player’s GizmoSphere without change something in other enemies with same script and components. There’s a way to take the component of the collided/trigger with the gizmoradius of the object inside the function?

THANK U SO MUCH !

and have a nice day =)

i get the radius of th gizmos and i give it to a float variable, then i calculate if the distance from player/enemy is less than the radius. I can change that but i still need to know how to interact with just the enemies insied the range that i need without touching other enemies that i place in the game and without adding to the script all the enemies on the map =/