Score with Text going up by random increments

Hello all,

I am currently trying to update my SCHMUP so that the player’s score goes up by 100 when an enemy is destroyed. I have a Text in the Canvas which has a script managing the score that looks like this:

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

public class ScoreScript : MonoBehaviour {

	Text scoreWords;

	int playerScore;

	public int PlayerScore
	{
		get
		{
			return this.playerScore;
		}
		set
		{
			this.playerScore = value;
			UpdateScore();
		}
	}


	// Use this for initialization
	void Start () {

		scoreWords = GetComponent<Text>();
	
	}
	
	// Update is called once per frame
	void UpdateScore () {

		string scoreString = string.Format("{0:00000000}", playerScore);
		scoreWords.text = scoreString;
	
	}

I also have a script attached to each enemy that controls when they are destroyed that looks like this:

using UnityEngine;
using System.Collections;

public class Damage : MonoBehaviour {

	GameObject ScoreText;

	public int health = 1;



	bool isColliding;



	void Start(){

		ScoreText = GameObject.FindGameObjectWithTag("Score");

	}

	void OnTriggerEnter2D(){

		if(isColliding) return;

		isColliding = true;
		
		health--;
		
	}

	void Update(){

		isColliding = false;


		if(health <= 0){
			
			Die();
		}
	}

	void Die(){

		ScoreText.GetComponent<ScoreScript>().PlayerScore += 100;
		Destroy(gameObject);
		
	}

	
}

The problem is, when an enemy is destroyed it randomly adds either 200, 300, or 400 points. Never 100. Also, enemies with health greater than 1 give points from all hits and not just from their destruction. If anyone could help me figure out why this is happening, I would be very grateful.

Try to use the Update function as little as possible. All your actions are event driven so only activate them on that event. Check your health<=0 in the OnTriggerEnter2D function and call the Die function there.