unity change sprite of a gameobject code example Example: change sprite of gameobject unity gameObjectName.GetComponent<SpriteRenderer>().sprite = spriteName;