Spawning unique enemies
Hello, I am working on a 3d FPS type shooter and I am running into a small issue when it comes to my enemies. Currently I have a basic enemy that will look at, then follow the player while "shooting" at it printing "hit." I also have a line of code that finds the Body mesh of the enemy and changes the albedo from green to red to give a visual indicator that the enemy sees the player and is running the proper code. Additionally, I have a signal emitting from the player's weapon script when a raycast is emitted and collides into anything within the group "Enemies", which the enemy is in, and outputs "enemy damaged."
My issue seems to be that Godot doesn't distinguish between the two Enemy scrips when running the code. If the player walks into the view of Enemy1, both enemies will turn red even though only Enemy1 goes into the alert state and follows the player. Also, when the player shoots at the enemy the output will printout two lines of "enemy damaged." It appears that since both enemies have the name "Enemy" with a mesh named "Body" the script will bring up both when they are called even though they are separate instances. I need to make them each unique but I haven't been able to find a way to do it that doesn't involve giving every enemy in the game a unique name, which seems silly.
Anyone have any pointers?