// Update is called once per frame void Update() { if (player != null) { barDisplay = (float)player.getCurrentHP() / player.getMaxHP();//divided by max HP to get num between 0 and 1 } }