Can't get UI Healthbar to Decrease with each hit (unity4.6) (Solved)

I’m the new unity 4.6 UI features to create an onscreen health bar. But I can’t get the bar to decrease each time my object is hit.

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

public class MegonHealthBar : MonoBehaviour
{

	public static bool isHit = false;
	

	void ReduceHealthBar()
	{
		if(isHit = true)
		{
			Image Image = GetComponent<Image>();
			Image.fillAmount -= .1667f;
		}
	}

The code that’s currently in the IF statement I’ve tested in an Update function and the bar decreased over time as I hoped. (I’m assuming here that indicates I have the basic set up of the bar correct)

But since I’ve changed it to rely on an IF statement the bar does not reduce.

I have this code running in another script, telling the health bar when a hit has occurred -

if(collider.gameObject.tag == "CannonBall")
		{
			megonLife -= 1;
			audio.PlayOneShot(audio.clip, 4.0f);
			Instantiate(bossExplosion, transform.position, transform.rotation); // Instantiate Explosion Effect
			MegonHealthBar.isHit = true;
		}

Any suggestions as to what I’m doing wrong

???

ReduceHealthBar()

isn’t a function that runs every frame.

Putting it in an update would fix that, but you might as well switch ReduceHealthBar() for Update(), which DOES update each frame.

 if(isHit = true)

should be

 if(isHit) //or  if(isHit == true), but that's pointless

The if should reset isHit to false if you don’t want to deplete the health bar in 1 hit.

void ReduceHealthBar()
{
 if(isHit = true)
 {
  Image Image = GetComponent<Image>();
  Image.fillAmount -= .1667f;
 }
}

should be

void Update()
{
 if(isHit = true)
 {
  Image Image = GetComponent<Image>();
  Image.fillAmount -= .1667f;
  isHit = false;
 }
}