title: Create a new class inherited from an existing class using reflection
body: <p>How can I derive from a class through reflection? The following works for getting an existing instance and for creating a new instance of the class.</p>
  
  <pre><code>public class TreeViewSHWinstances {
  
      [MenuItem("Reflect/CreateSHWinstances")]
      static void Activate() {
          Main();
      }
  
      static void Main() {
  
          Assembly asm = typeof(UnityEditor.EditorWindow).Assembly;
  
          Type wndType = asm.GetType ("UnityEditor.SceneHierarchyWindow");
  
          // Grabs an existing instance if it exists and then sets the focus to it.
          EditorWindow exstWnd = EditorWindow.GetWindow (wndType);
  
          // Always create a new instance regardless if one already exists.
          EditorWindow newWnd = (EditorWindow)Activator.CreateInstance (wndType);
      }
  
  }
  </code></pre>
  
  <p>This is what I actually want to do, but obviously the assembly is not yet loaded and when I have tried to acquire it form the above class I get an error that says it is not a Type even though I'm requesting wndType.</p>
  
  <pre><code>// THIS IS NOT INTENDED TO NOR DOES IT WORK.
  public MySceneHierarchyWindow : UnityEditor.SceneHierarchyWindow {
  
  
  }
  </code></pre>
  
  <p>My guess was to use Emit in some way, but I after experimenting with it I'm not sure it is the right direction.</p>