Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Inheriting from Inherited EditorWindow causes 'Failed to Load' error

Discussion in 'Immediate Mode GUI (IMGUI)' started by Newcomma, May 11, 2016.

  1. Newcomma

    Newcomma

    Joined:
    Feb 10, 2015
    Posts:
    89
    Hi Guys,

    So if my code looks like this:

    Code (CSharp):
    1. public class A : EditorWindow
    2. {
    3. }
    4.  
    5. public class B : A
    6. {
    7.     [MenuItem("Windows/B")]
    8.     static void Init()
    9.     {
    10.         EditorWindow.GetWindow<B>().Show();
    11.     }
    12. }
    And I add window B to the editor. If I restart Unity, the B window will *always* fail to load. It seems that Unity doesn't handle multiple inheritance from Editor Window correctly when Unity has to load, window A however will always load correctly.

    Is this bug known? Or am I missing something major?
     
    Last edited: May 16, 2016
  2. Newcomma

    Newcomma

    Joined:
    Feb 10, 2015
    Posts:
    89
  3. SteveFSP

    SteveFSP

    Joined:
    May 17, 2010
    Posts:
    8
    I added inheritance to one of my editor windows to see if I could reproduce your error. Everything worked fine.

    One of the common causes of the "Failed to load" error is that the name of the class does not match the name of the source file. You might want to verify that each of your classes is located in its own source file and that the file names are correct, including capitalization.