Reffering to gameObject that Instantiated this gameObject

I’m creating a bomberman2D - like game. I want to check who Instantiated the bomb .

So far I have done it like this :

 private GameObject Player = null;
private void OnTriggerEnter2D(Collider2D collider)
    {
        
        if (collider.gameObject.CompareTag("Player") && Player == null)
        {
            Player = collider.gameObject;
            Debug.Log("The player who set a bomb is : " + Player.name);
        }

    }

    void OnTriggerExit2D(Collider2D other)
    {
        boxCollider.isTrigger = false;
    }

The problem appears when two players are in the same place and one of them is dropping a bomb. It works for one of them, but not for the both - like Unity is “seeing” the collision of one of them as first. How can I refer to the gameObject that Instantiated the bomb in another way?

If I understand you right, you can create method in your bomb script, for example

private GameObject Player = null;
public void SetPlayer(GameObject player)
{
Player = player;
}

and right after you instantiate bomb (i think, you do it somewhere from player object, call this method and pass link to player gameobject there