Skip to content

Instantly share code, notes, and snippets.

@antonkudin
Created September 3, 2014 19:37
Show Gist options
  • Save antonkudin/129fd83d401015686589 to your computer and use it in GitHub Desktop.
Save antonkudin/129fd83d401015686589 to your computer and use it in GitHub Desktop.
Sprite tempSprite;
SpriteRenderer changeSprite;
void Update(){
changeSprite = gameObject.GetComponent<SpriteRenderer>();
switch(type){
case 0:
tempSprite = Resources.Load<Sprite>("tiles-wall_brick");
changeSprite.sprite=tempSprite;
break;
default:
tempSprite = Resources.Load<Sprite>("genericbox");
changeSprite.sprite=tempSprite;
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment