I have a script that has no errors but it won’t change the color of the game object. I am not sure how to fix it or where to start.
public Sprite player;
public Sprite Orange;
public Sprite Red;
public Sprite Blue;
void Start () {
}
void Update () {
if (Input.GetKeyDown (KeyCode.O))
this.gameObject.GetComponent<SpriteRenderer> ().sprite = Orange;
if (Input.GetKeyDown (KeyCode.P))
this.gameObject.GetComponent<SpriteRenderer> ().sprite = Blue;
if (Input.GetKeyDown (KeyCode.I))
this.gameObject.GetComponent<SpriteRenderer> ().sprite = Red;
}
}