using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class HUD : MonoBehaviour {
public Sprite[ ] HeartSprites;
public Image HeartUI;
private Healthforplayer player;
void Start () {
This one —> player = GameObject.FindGameObjectWithTag(“Player”).GetComponent();
}
void Update () {
and this one -----> HeartUI.sprite = HeartSprites[player.curhealth];
}
}