error CS1061: Type `UnityEngine.UI.Image' does not contain a definition for `enable' and no extension method `enable' of type `UnityEngine.UI.Image' could be found. Are you missing an assembly reference?
Код:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class HealthSystem : MonoBehaviour {
public int health;
public int numberOfLives;
public Image[] lives;
public Sprite fullLive;
public Sprite emptyLive;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
for (int i = 0; i < lives.Length; i++)
{
if (i < numberOfLives)
{
lives[i].enable = true;
}
else
{
lives[i].enable = false;
}
}
}
}