Score counter not working properly.

Heya, I am new to Unity and c# … I am just making a simple vertical shooter and am now up to keeping score! I just want to score 1 point each time an enemy is destroyed (all it takes is one shot from the bullet). Now at the moment, what my score counter is doing is scoring a point each time you hit the enemy, however if you miss the enemy, say 3 times in a row, the score will tally up for when you next hit the enemy… So you could be on 1 point, miss three times, then hit an enemy and your score will go from 1 to 4 . I tried changing the score codes from the EnemyScript and putting it instead in the BulletScript, but no change. I think it’s something simple I am missing but I am not sure what it is! Any help would be appreciated… Here is my bullet script as it stands currently:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class BulletScript : MonoBehaviour {

public float BulletSpeed = 5f;
public PlayerController playerController;
public int Count;
public Text CountText;

void Update () { 
	transform.Translate (Vector3.up * BulletSpeed * Time.deltaTime);

}
void OnBecameInvisible () { 
	this.gameObject.SetActive (false);
}

void OnTriggerEnter2D(Collider2D other)
{

	if (other.gameObject.tag == "Enemy")
		gameObject.SetActive (false);

	playerController.CountText.text = playerController.Count.ToString();

}

void Start() { 
	playerController = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>();

}

}

Thank you!

playerController.Count++;
playerController.CountText.text = playerController.Count.ToString();

? You weren’t incrementing anywhere here. :slight_smile: