title: Changing an object change all the instantiated objects
body: <p>I know that the topic of the question has been already asked and some answer have been given to it, but i'm asking it again because i fail misserably when i try to apply the answers from the other topics.</p>
  
  <p>The problem that i have is that, i have a prefab (quad) 'Star' with a material into it and an script that makes it change color after some time:</p>
  
  <pre><code>using UnityEngine;
  
  public class Star: MonoBehaviour {
    public enum StarType {
      BRIGHT,
      DARK,
      F,
      K,
      L,
      P
    }
  
    private Ship ship;
    private StarType starType;
    private float timeLimit = .30f, timer;
    private System.Random rand;
  
    public void Awake() {
      ship = FindObjectOfType&lt;Ship&gt;();
  
      timer = .0f;
      rand = new System.Random();
    }
  
    public void Start() {
      refactor();
    }
  
    public void Update() {
      timer += Time.deltaTime;
      if(timer &gt; timeLimit) {
          refactor();
          timer = .0f;
      }
    }
  
    public void LateUpdate() {
      transform.eulerAngles = new Vector3(ship.transform.eulerAngles.x,
                                          ship.transform.eulerAngles.y,
                                          ship.transform.eulerAngles.z);
    }
  
    public void refactor() {
      starType = (StarType) rand.Next(0, 
               System.Enum.GetValues(typeof(StarType)).Length);
      switch(starType ) {
      case StarType.BRIGHT:
          renderer.material.color = Color.white;
          break;
      case StarType.DARK:
          renderer.material.color = Color.black;
          break;
      case StarType.F:
          renderer.material.color = Color.red;
          break;
      case StarType.K:
          renderer.material.color = Color.cyan;
          break;
      case StarType.L:
          renderer.material.color = Color.green;
          break;
      case StarType.P:
          renderer.material.color = Color.magenta;
          break;
      }
    }
  
    public StarType getStarType() {
      return starType;
    }
  }
  </code></pre>
  
  <p>And this stars being instantiated in a Chunk class:</p>
  
  <pre><code>public class Chunk : MonoBehaviour {
    public Star star;
  
    private IList&lt;Star&gt; stars;
  
    public void Awake() {
      stars = new List&lt;Star&gt;();
  
      Star auxStar = (Star) Instantiate(star, transform.position, 
                        Quaternion.identity);
      auxStar.transform.SetParent(transform);
  
      stars.Add(auxStar);
    }
  }
  </code></pre>
  
  <p>I was assuming that each star would change the color independently, but instead of that they all change to the same color.</p>
  
  <p>I've tried using sharedMaterial instead of material as i read it on some asnwers, though the result and behaviour seems the same?, and i tried giving random init colors to the stars, but the most that i get is having a few of them changing to a color different from the rest, though still the same between them (And i'm trying to change colors all the time, not only upon creation).
  I've read too creating a material and asigning to each one at instantiating, but i had no luck:</p>
  
  <pre><code>auxStar.renderer.material = (Material) 
                                   Instantiate(star.renderer.material);
  </code></pre>
  
  <p>Does someone know how can the problem be handled?</p>