void Start() { iconContol = FindObjectOfType<IconController>(); hex = GetComponentInParent<Hex>(); icon = GetComponent<Image>(); hexVeg = hex.GetVegetation(); prevVeg = hexVeg; icon.color = iconContol.GetHexVegColor(hexVeg); }
void Update() { prevVeg = hexVeg; hexVeg = hex.GetVegetation(); icon = GetComponent<Image>(); if(hexVeg != prevVeg) { prevVeg = hexVeg; icon.color = iconContol.GetHexVegColor(hexVeg); } }