How to differentiate between different instances of the same GameObject?

I have a trigger that activates a warning alarm if an enemy passes through it. If the player is moving upwards at a good pace then the enemy will trigger it only once and all is good. However, if the player stops the enemy will trigger it multiple times(the enemy is jumping up and down constantly). I want to be able to tell if the same enemy instance has triggered it already so I don’t sound the alarm more than once. The enemies are spawned from the same prefab.

Here is what I have so far:

public class Warning : MonoBehaviour {

	public GameObject warning;
	public GameObject enemy;



	void OnTriggerEnter2D(Collider2D other) {
		if (other.gameObject.tag == "Enemy" && other.gameObject != enemy) {
			enemy = other.gameObject;
			warning.transform.position = new Vector2(enemy.transform.position.x,this.gameObject.transform.position.y);
			warning.SetActive(true);
			StartCoroutine(WaitToDisable());

		}
	}

So, when an enemy activates the trigger I set its gameObject equal to the ‘enemy’ variable and then when another trigger event takes place I compare the new one against the old one inside of the if statement in the OnTriggerEnter2D(). Will this work or is that just comparing whether they are the same type of GameObject?

you can add tag when you instantiate

gameobject.tag=“name_”+someinteger.ToString();