Destroy button only destroys the last clone of object

Hello, I am working on a 2d isometric grid building system, and I have encountered a problem with destroying already placed objects. So I have a prefab with a panel and buttons, one button for placement and the other for destroying the prefab clones. It works but only for the prefab clone that was placed last. If I try to destroy others I get this error “MissingReferenceException: The object of type ‘Building’ has been destroyed but you are still trying to access it.”.

Here is the code I use to instantiate objects

 public void InstantiateObject(GameObject gameObject)
    {
        if(!objectUnplaced)
        {
            if (canBePlaced)
            {
               current=Instantiate(gameObject,Vector3.zero,Quaternion.identity).GetComponent<Building();
                GridBuildingSystem.instance.FollowBuilding(current);
                towerUnplaced = true;
            }
        }

    }

This method is called from buttons script:

 public void DestroyObject()
    {
        Destroy(gameObject);
    }

I understand what the error means but I don’t really know how to solve it, does anybody have any suggestions on how to fix it?

You shouldn’t use “gameObject” as a parameter name because “gameObject” is the Game Object the script is attached to, which also means your DestroyObject function is probably only deleting the Game Object the script is attached to. Maybe this is creating the problem

Try using a different name and see if it helps