title: How can I change the editor window size depending on the content?
body: <p>For example I set the window size to 800x800 also the scroll view size is 800x800</p>
  
  <p>But in this case when the content is not expanded so the content is on the top but the rest of the window is empty. I could resize the window now on my own but then when I expand the content I will have to resize the window again.</p>
  
  <p>Visual it looks bad.</p>
  
  <p><a href="https://i.stack.imgur.com/ugZxT.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ugZxT.jpg" alt="Content is not much so most of the window is empty"></a></p>
  
  <p>Then when expanding the content :
  Now the content is over too much the window size so now the scroll view is show up :</p>
  
  <p><a href="https://i.stack.imgur.com/MhFqs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MhFqs.jpg" alt="Content is too long so the scroll view is now show"></a></p>
  
  <p>But now I have another problem. The scroll view vertical is not working. When trying to scroll down it keep moving the scroller back up. It never move down.</p>
  
  <p>And if I will collapse back up the content it will look like again like in the first screenshot.</p>
  
  <p>In general my problem is how to use the window size with the scroll view and the content so it will not look like in the first screenshot and that the scroll view will work when it show up.</p>
  
  <p>The editor window script :</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEditor;
  using UnityEditorInternal;
  using UnityEngine;
  
  public class ConversationsEditorWindow : EditorWindow
  {
      Vector2 scrollPos;
  
      [MenuItem("Window/Editor Window Test")]
      static void Init()
      {
          const int width = 800;
          const int height = 800;
  
          var x = (Screen.currentResolution.width - width) / 2;
          var y = (Screen.currentResolution.height - height) / 2;
  
          GetWindow&lt;ConversationsEditorWindow&gt;().position = new Rect(x, y, width, height);
      }
  
      void OnGUI()
      {
          GameObject sel = Selection.activeGameObject;
          ConversationTrigger targetComp = sel.GetComponent&lt;ConversationTrigger&gt;();
  
          if (targetComp != null)
          {
              EditorGUILayout.BeginVertical();
              EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(800), GUILayout.Height(800));
              var editor = Editor.CreateEditor(targetComp);
              var tar = editor.targets;
              editor.OnInspectorGUI();
              EditorGUILayout.EndScrollView();
              EditorGUILayout.EndVertical();
          }
      }
  }
  </code></pre>