title: Change sprite color in unity using GUI button
body: <p>I'm creating a Unity program where I want to use a GUI button to change the color of a sprite. I have the following code in my script but I'm not sure how to change the color.</p>
  
  <pre><code>public GameObject WantedSprite;
  
  private void DrawWindow(int windowID)
  {
      if (GUI.Button(new Rect(50, 150, 100, 50), "Change the Ball's color"))
          {
              var component = WantedSprite.GetComponent&lt;Color&gt;();
              component.g = Random.Range(0, 255);
              component.r = Random.Range(0, 255);
              component.b = Random.Range(0, 255);
          }
  </code></pre>
  
  <p>I'm learning Unity so that's a little of my background, thank you!</p>