title: C# Automatic references assignment - making references null
body: <p>The C# scripting environement in Unity3D (runned under Mono) has a nice behavior when detroying objects. All the references that point to the destroyed object gets automaticly null :</p>
  
  <pre><code>    GameObject ref1 = (GameObject)Instantiate(obj);
      GameObject ref2 = ref1;
  
      if (ref1 != null)
          Debug.Log("ref1 is not null");
  
      DestroyImmediate(ref1);
  
      if (ref1 == null)
          Debug.Log("ref1 is null");
  
      if (ref2 == null)
          Debug.Log("ref2 is null");    
  </code></pre>
  
  <p>Output :</p>
  
  <pre><code>    ref1 is not null
      ref1 is null
      ref2 is null
  </code></pre>
  
  <p>Any ideas on how to acheive this ?</p>
  
  <p>Thanks</p>