title: How to programmatically assign a random sprite to game object?
body: <p>I have a function that generates a game object on screen every 100 frames:</p>
  
  <pre><code> var trash : Transform ;
   function Update()
   {
        if(count == 1)
        {
           Instantiate(trash,new Vector3(UnityEngine.Random.Range(-3f,3f),UnityEngine.Random.Range(-3f,3f),UnityEngine.Random.Range(-3f,3f)), Quaternion.identity);
        }
  
       else if(count == 100)
       {
           count = 0;
       }
   }
  </code></pre>
  
  <p>Now, I want each of those generated objects to pick a random sprite from my assets. I thought about making a sprite array and picking from that, but I'm not sure how to go about doing so or how to assign the sprite to the object.</p>
  
  <p>Anu help would be much appreciated!</p>