How could I diferentiate between clones?

Hi everyone, ive got stuck on a piece for the game im working on

first of all the problomatic code
part 1

function OnGUI () 
	{
		
		
		if(isincombat)
			{
				GUI.Label (Rect (700, 10, 500, 300), "" + enemymonster.name);
				GUI.Label (Rect (700, 30, 500, 300), "" + enemymonster.baseHP + "/" + enemymonster.currHP);
				GUI.DrawTexture (Rect(900, 130, 128, 128), enemymonster.image);
					if(spawned == false) 
						{
							Instantiate(enemymonster.gamemodel,enemymonsterspawn.transform.position,enemymonsterspawn.transform.rotation);
							spawned = true;
						}
				GUI.Label (Rect (10, 10, 500, 300), "" + equippedmonster.name);
				GUI.Label (Rect (10, 30, 500, 300), "" + equippedmonster.baseHP + "/" + equippedmonster.currHP);
				GUI.DrawTexture (Rect(70, 10, 128, 128), equippedmonster.image);
				GUI.Label (Rect (10, 50, 500, 300),"Level " + equippedmonster.level + " XP " + equippedmonster.curXp + " / " + equippedmonster.maxXp);
				if(spawned2 == false) 
					{
						Instantiate(equippedmonster.gamemodel,mymonsterspawn.transform.position,mymonsterspawn.transform.rotation);
						spawned2 = true;
					}
				
				if (!spawned)
					{
						Destroy(GameObject.Find(enemymonster.name + "(Clone)"));
					}
				if (!spawned2)
					{
						Destroy(GameObject.Find(equippedmonster.name + "(Clone)"));
					}
 	if (!displaygui) return;

if(monstersub)
		{	for(var k=0; k < 6; k++)
				{
					
					if(GUI.Button(Rect(700,150 + (k * 50),100, 30),"" + mymonsters[k].name))

				{
					Destroy(GameObject.Find(equippedmonster.name + "(Clone)"));
					equippedmonster = mymonsters[k];
					if(spawned2)
					{
					Instantiate(equippedmonster.gamemodel,mymonsterspawn.transform.position,mymonsterspawn.transform.rotation);
					}	
				}
			
			}

now the problem im facing is that way im despawning the monsters by finding by name + clone is fine but when the players equipped monster is has the same name as the enemy monster there is no way of telling which one to destroy and it generally destroys the wrong one.

Oh the monsters are an array containing the gamemodels stats etc

hope im making sense and would appreciate any help or maybe a better way of placing and destroying prefabs runtime.

I’m not 100% sure I understand your game mechanic, but I’m imagining a Pokemon style game. If that’s right, there are two ways to do this.

Local variables

Instead of Instantiating the monsters and then searching for them, have your script store what gets created.

At the top of your script, create two new GameObject variables: equippedMonster and enemyMonster. Then, when you instantiate them, do this:

equippedMonster = Instantiate(equippedmonster.gamemodel,mymonsterspawn.transform.position,mymonsterspawn.transform.rotation);

Then when you go to despawn, you can refer to them directly:

Destroy(equippedMonster);

Unique IDs

If you can’t do that for some reason, you could store the unique instance ID of each of your spawned monsters.

spawnedMonster.GetInstanceID();

Easy :-).