Unique names for Instantiated prefabs?

Hey guys,
So I’m trying to create a Combat System. I currently have the Enemy.js script and an EnviromentHandler.js script. The EnviromentHandler instantiates 2 enemies both in different positions:

var enemySpawn : Rigidbody;
var bossSpawn : Rigidbody;

static var ENEMYBASEHEALTH = 60;
static var PLAYERBASEHEALTH = 90;
static var SWORDDAMAGE = 25;
static var GUNDAMAGE = 10;

function Start()
var enemyClone : Rigidbody;
enemyClone = Instantiate(enemySpawn, Vector3(50,14.3,-19), transform.rotation);
enemyClone = Instantiate(enemySpawn, Vector3(27,14.3,-19), transform.rotation);


Now the problem I have is each of these clones get the Script Enemy.js and when I try to apply damage to the script both of the clones take damage. What i need to do is make them both unique by changing there name…

The simple way to do this would be to do:

enemyClone =
enemyClone1 =

but when I want to do is add a automatic generator to add the number at the end of the name… How is this done?

You can assign unique names like this, and use Find to get the particular one:

var nextNameNumber = 0;

function MyFunction ....

  enemyClone = Instantiate(enemySpawn, Vector3(27,14.3,-19), transform.rotation);
  enemyClone.name = "enemy"+nextNameNumber;

But you may just want to put them into an Array or List to keep track of them without having to use Find