How to limit bullets in screen like old NES game

Hello am trying to limit bullet in screen like Journey to Silius (NES game)

this game can shot only 3 bullet but after bullet off the screen or collide with something

will able to shoot 3 shot again

this is my code:

////////////////

Control.cs

`using UnityEngine;
using System.Collections;

public class Control : MonoBehaviour {

public GameObject BulletPrefab;
public int weapon = 2;


public static int bulletCount =0;



// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
print(bulletCount);
if(Input.GetKeyDown("w"))
	{
			if(bulletCount <3)
				{			
					bulletCount++;
					pistol();
					
				}	
	}

}
 void pistol(){
		
		Instantiate(BulletPrefab, transform.position, transform.rotation);
		
		
}

}

///////////////////////////////////////
bullet.cs

using UnityEngine;
using System.Collections;

public class Bullet : MonoBehaviour {

public float BulletSpeed;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
	float toMove = BulletSpeed * Time.deltaTime;
	transform.Translate(Vector3.forward * toMove);
	Destroy(gameObject,2);
	Control.bulletCount--;

    
}
 void OnCollisionEnter(Collision collision) {
	Destroy(gameObject);
	Control.bulletCount--;
	
	
}

}

Well, you’re almost there. Add a box Collider around the camera (orthographic right ?), make sure the sides of the box are on the side of the frustrum, tag it and enable isTrigger. In your bullet script, in the function OnTriggerExit, check the tag and destroy.

bulletCount was behaving properly so far ?

bulletCount not really properly at update function it keep minus bulletCount maybe because

of call once per frame, so do you have any idea where to put bulletCount when the bullet

didnt hit anything and destroy by timer ( onCollisionEnter bulletCount work pretty decent )

bulletCount at function update seem to be the only problem can we fix this ?

thank for your help.

bulletCount not really properly at update function it keep minus bulletCount maybe because

of call once per frame, so do you have any idea where to put bulletCount when the bullet

didnt hit anything and destroy by timer ( onCollisionEnter bulletCount work pretty decent )

bulletCount at function update seem to be the only problem can we fix this ?

thank for your help.

thank for your help

bulletCount at update function is the only problem because it call every frame so

bulletCount keep counting minus I don’t sure how to fix this