how do I make it so my building prefab instantiates only once

I’m trying to make something where when a button is pressed a building prefab is instantiated and appears in a position on a globe. I only want 1 building to be spawned and no more. i kind of know what i need to do but I’m not sure how to put it into code as i am a beginner and just learning as i go.

here is the script i am using to instantiate the buildings

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Spawner : MonoBehaviour
{
    public Transform[] spawnLocations;
    public GameObject[] WhatToSpawnPrefab;
    public GameObject[] WhatToSpawnClone;
    


    public void Update()

    {
     


     SpawnBuilding();

   

        void SpawnBuilding()

            
        {
            if (Input.GetKeyDown("1"))

            {
                GameObject go = Instantiate(WhatToSpawnPrefab[0], spawnLocations[0].transform.position, Quaternion.Euler(85, 90, 360)) as GameObject;
                go.transform.parent = GameObject.Find("Globe").transform;
            }

          

        }
    }

}

any help would be greatly appreciated!

i am beginner too but you can try to write your codes into start method.

could have a bool called alreadyInstantiated or something and then change your code to this: `

if (Input.GetKeyDown(“1”) && !alreadyInstantiated)

         {
             alreadyInstantiated = true;
             GameObject go = Instantiate(WhatToSpawnPrefab[0], 
             spawnLocations[0].transform.position, 
             Quaternion.Euler(85, 90, 360)) as GameObject;
             go.transform.parent = GameObject.Find("Globe").transform;
         }

else {alreadyInstantiated = false;}`