# How to make a command change the sprite?

**URL:** https://discussions.unity.com/t/how-to-make-a-command-change-the-sprite/581809
**Category:** 2D
**Tags:** Scripting
**Created:** [May 23, 2015, 9:37pm UTC](https://discussions.unity.com/t/how-to-make-a-command-change-the-sprite/581809 "2015-05-23T21:37:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![123fendas](https://avatars.discourse-cdn.com/v4/letter/1/4bbf92/32.png) [@123fendas](https://discussions.unity.com/u/123fendas)
#### Post date: [May 23, 2015, 9:37pm UTC](https://discussions.unity.com/t/how-to-make-a-command-change-the-sprite/581809/1 "2015-05-23T21:37:06Z")

</div>

I know there are many topics about this, but I found them really confusing.

How do I simply make lines of code that 1. adds the sprite 2. actually change the sprite

Tell me like I was an 8 year old, beacuse this is confusing.

Oh, and CSharp. Duh.

---

<div class="post-metadata">

### Author: ![JoeStrout](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/joestrout/32/200738_2.png) [@JoeStrout](https://discussions.unity.com/u/JoeStrout)
#### Post date: [May 24, 2015, 2:47am UTC](https://discussions.unity.com/t/how-to-make-a-command-change-the-sprite/581809/2 "2015-05-24T02:47:56Z")

</div>

I don’t know what “adds the sprite” is. But I can show you how to change the sprite…

```csharp
GetComponent<SpriteRenderer>().sprite = someOtherSprite;

```

…where someOtherSprite is a variable or property of type Sprite.

---

<div class="post-metadata">

### Author: ![123fendas](https://avatars.discourse-cdn.com/v4/letter/1/4bbf92/32.png) [@123fendas](https://discussions.unity.com/u/123fendas)
#### Post date: [July 26, 2015, 9:26am UTC](https://discussions.unity.com/t/how-to-make-a-command-change-the-sprite/581809/3 "2015-07-26T09:26:56Z")

</div>

I know I’m late, but thank you so much! This has helped me make my first games!  
I figured out on my own how to add the sprite.

```csharp
public Sprite someOtherSprite;

```

And then in the editor you drag an image into the box where the script is in the menu.
