public void SwapSprite(Gems newGems) { if (spriteRenderer.sprite == newGems.GetComponent <SpriteRenderer>().sprite) { return; } Sprite temp = this.spriteRenderer.sprite; this.spriteRenderer.sprite = newGems.spriteRenderer.sprite; newGems.spriteRenderer.sprite = temp; int nid = this.id; this.id = newGems.id; newGems.id = nid; }