Finding Missing Object References in Unity

Just execute the following code from the menu “Tools/Find Missing references in scene”.

   1:  [MenuItem("Tools/Find Missing references in scene")]
   2:  public static void FindMissingReferences()
   3:  {
   4:      var objects = GameObject.FindObjectsOfType<GameObject>();
   5:   
   6:      foreach (var go in objects)
   7:      {
   8:          var components = go.GetComponents<Component>();
   9:   
  10:          foreach (var c in components)
  11:          {
  12:              SerializedObject so = new SerializedObject(c);
  13:              var sp = so.GetIterator();
  14:   
  15:              while (sp.NextVisible(true))
  16:              {
  17:                  if (sp.propertyType == SerializedPropertyType.ObjectReference)
  18:                  {
  19:                      if (sp.objectReferenceValue == null && sp.objectReferenceInstanceIDValue != 0)
  20:                      {
  21:                          ShowError(FullObjectPath(go), sp.name);
  22:                      }
  23:                  }
  24:              }
  25:          }
  26:      }
  27:  }
  28:   
  29:  private static void ShowError (string objectName, string propertyName)
  30:  {
  31:      Debug.LogError("Missing reference found in: " + objectName + ", Property : " + propertyName);
  32:  }
  33:   
  34:  private static string FullObjectPath(GameObject go)
  35:  {
  36:      return go.transform.parent == null ? go.name : FullObjectPath(go.transform.parent.gameObject) + "/" + go.name;
Source: http://gamasutra.com/blogs/LiorTal/2014120...