Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Bug 999+ errors on compiling

Discussion in 'Editor & General Support' started by BalDChauve, Oct 25, 2022.

  1. BalDChauve


    Dec 3, 2019

    We're having a relatively harmless, but annoying bug on our project. We're having these two errors appearing multiples times every time our scripts recompiles. It goes away when we restart Unity.
    The error appearance is not constant, as we can have multiples recompiles without it appearing, but as soon as it appears once, it will continue appearing, and the errors count will increase every time.

    For exemple (I'll take random numbers) :
    I start up Unity, and just work as usual.
    No errors appear until the 7th recompile. We then have ~40 of these errors.
    At the 8th recompile, we have ~100 of these.
    At the 9th, we have ~200
    At the 10th, ~500

    We're in Unity (2D) 2021.3.10f1, using URP.
    We already tried :
    - Closing a potential second inspector window
    - Closing every single window
    - Removing every single asset
    - In an empty scene
    - "Reimport All"
    - Not having a GO selected in inspector

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.GameObjectInspector.OnDisable () (at <99feab6f3db6407493924fe4a179a95b>:0)


    SerializedObjectNotCreatableException: Object at index 0 is null
    UnityEditor.Editor.CreateSerializedObject () (at <99feab6f3db6407493924fe4a179a95b>:0)
    UnityEditor.Editor.GetSerializedObjectInternal () (at <99feab6f3db6407493924fe4a179a95b>:0)
    UnityEditor.Editor.get_serializedObject () (at <99feab6f3db6407493924fe4a179a95b>:0)
    UnityEditor.GameObjectInspector.OnEnable () (at <99feab6f3db6407493924fe4a179a95b>:0)


    Thanks for your time!
  2. Thomas-Bousquet


    Dec 19, 2016
    I'm not sure this is helpful, but I encountered a very similar behaviour with an editor window I was developing and which was embedding a GameObjectInspector: error start appearing at one point and error count keeps getting bigger with each recompile even when the window is closed.

    I never managed to fix it (no amount of lifecycle management seemed to help) but you may want to search your codebase for Editor.CreateEditor to find culprits.

    If you find a solution, please post it here, I'll be interested as well :)
    BalDChauve likes this.
  3. BalDChauve


    Dec 3, 2019
    Sorry for the late replay, I wanted to make sure that the solution worked

    We indeed had a script with Editor.CreateEditor, so we commented out the parts using that and the errors haven't appeared since, we'll just scrap the script and do without it.

    Anyway, thanks a lot! You saved my hairs from being teared ahah