title: EditorGUILayout.ObjectField does not recieve reference
body: <p>I'm learning custom editors. The <code>ObjectField</code> appears and its possible to drag <code>Inventory</code> scripts or <code>GameObjects</code> containing them to the slot. But when dropped nothing happens. The field lights up but the dropped object doesn't stick. </p>
  
  <p>And when I push the button <code>target</code> is <code>null</code>. </p>
  
  <pre><code>public class AddInventory : EditorWindow {
  
      public Inventory target;
  
      [MenuItem("Inventory/Add items")]
      public static void ShowWindow()
      {
          GetWindow&lt;AddInventory&gt;("Add items");
      }
  
       void OnGUI()
      {
          GUILayout.Label("Add items to  inventory", EditorStyles.boldLabel);
          Inventory target = null;
          target = (Inventory) EditorGUILayout.ObjectField("Inventory thingy", target, typeof(Inventory), true);
  
  
          if (GUILayout.Button("I am button!"))
          {
              Debug.Log(target.thing);
  
          }
      }
  }
  </code></pre>
  
  <p>I also tried per suggestion: </p>
  
  <pre><code>   void OnGUI()
  {
  
      GUILayout.Label("Add items to  inventory", EditorStyles.boldLabel);
  
    var  myInventory = (GameObject) EditorGUILayout.ObjectField( myInventory, 
       typeof(GameObject), true);
  
  
      if (GUILayout.Button("I am button!"))
      {
          Debug.Log(myInventory.name);
  
      }
  }
  </code></pre>