public GameObject HealthPoint;
static GameObject[] HP = new GameObject[];
// Use this for initialization
void Start () {
for(int i = 0; i < StatsManager.ChassisHealth;i++)
{
HP[i] = Instantiate(HealthPoint,new Vector2(transform.position.x, transform.position.y),transform.rotation,this.gameObject.transform);
}
}
// Update is called once per frame
void LateUpdate () {
for (int j = StatsManager.ChassisHealth; j > P1Tank.CurrentHealth; j--) {
HP [j].GetComponent<Image> ().color = Color.red;
}
}
I am not entirely sure why it is returning this error and after spending quite a while on it, I just can’t seem to figure out what the issue is.