I need a button to click on the image (a shrub) to change (for a cow in front of the shrub).
public class mudaSprite : MonoBehaviour {
public InputField dgt;
public Text txt;
public Sprite arbusto;
SpriteRenderer spriteRenderer = GetComponent<SpriteRenderer>();
public void setget(){
if (dgt.text.ToLower().Equals("cinza")) {
if (spriteRenderer.sprite == null) {
spriteRenderer.sprite = Resources.Load<Sprite>("vacarbustoC");
}
ChangeTheDamnSprite ();
txt.text = "";
}
else {
txt.text="Tente Novamente!";
}
}
void ChangeTheDamnSprite(){
if (spriteRenderer.sprite == arbusto) {
spriteRenderer.sprite = Resources.Load<Sprite>("vacarbustoC");
} else {
spriteRenderer.sprite = arbusto;
}
}
Pleaaase !!