How To Add A Limit To Amount Of Objects

HELLO! It is me, I am working on a new project and in it the player has to place down bricks to build castles, and I cant figure out how to add a limit as to how many bricks the player can put down in a level, I have a “shooting” script, and when you press the left mouse button then the chosen projectile spawn area will spawn a projectile (brick) and in this game it will drop it then the player uses that to build their castle, what I want to do is add some sort of constraint to the number of bricks the player can place down, so they don’t mess the game up and to make it more challenging. Any ideas, answers, or questions that may help me with this problem? My shooting script is bellow, if you need any other information that will help you please comment and I will respond with the answer, I really need to figure out how to do this, THANKS!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Shoot : MonoBehaviour {
	public Rigidbody2D projectile;
	public Transform projectileSpawnPoint;
	public float projectileVelocity;
	public float timeBetweenShots;
	private float timeBetweenShotsCounter;
	private bool canShoot;
	// Use this for initialization
	void Start () {
		canShoot = false;
		timeBetweenShotsCounter = timeBetweenShots;
	}

	// Update is called once per frame
	void Update () {
		if (Input.GetMouseButtonDown(0) && canShoot)
		{
			Rigidbody2D bulletInstance = Instantiate(projectile, projectileSpawnPoint.position, Quaternion.Euler(new Vector3(0, 0, transform.localEulerAngles.z))) as Rigidbody2D;
			bulletInstance.GetComponent<Rigidbody2D>().AddForce(projectileSpawnPoint.right * projectileVelocity);
			canShoot = false;
		}
		if (!canShoot)
		{
			timeBetweenShotsCounter -= Time.deltaTime;
			if(timeBetweenShotsCounter <= 0)
			{
				canShoot = true;
				timeBetweenShotsCounter = timeBetweenShots;
			}
		}
	}

There is a very easy way to do it. Here is how it will basically work: There will be a list in your script. It will detect any brick that is on the current scene. If there are X bricks, then the player is not going to be able to shoot anymore.

Now let’s get to the coding part. First, you will need an array. Arrays are basically lists you can use to hold more than one thing without making a giant code, and it has a lot of other cool functions. You will also need an Int, we will call it number. You will have to change number (the int)'s value to the one you want to be the maximum bricks the player can spawn.

private GameObject[] brickList;
public int number;

After making an Array, go to the Editor again, and on the Inspector, create a new tag and tag the original brick prefab as it. Let’s say you made a new tag called BRICK and you tagged your brick prefab as said tag.

Now we need to tell the array to store all the GameObjects tagged as BRICK into it. I am going to use it on the Update function, but there are a lot of better ways to do it, this is just an example.

    Void Update()
{
    brickList = GameObject.FindGameObjectsWithTag("BRICK");
}

Now we just need to make sure that IF our Array does have X number of bricks, the player can’t shoot anymore (We will disable his canShoot bool).

            if (brickList[number])
            {
                canShoot = false;
            }

As i said, this is just an Example. There are a lot of other ways to do it, i just wanted to make it as simple as possible so you could easily understand. I hope this helped, Good Luck! =]