Search Unity

Bug Unity 2020.1.9f1 - Object reference not set to an instance of an object

Discussion in 'Editor & General Support' started by Amon, Oct 22, 2020.

  1. Amon

    Amon

    Joined:
    Oct 18, 2009
    Posts:
    1,384
    I've tried reinstalling unity, fresh projects etc but I get this on startup and whenever I arrange the editor windows.

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEngine.UIElements.StyleSheets.StyleSelectorHelper.FastLookup (System.Collections.Generic.IDictionary`2[TKey,TValue] table, System.Collections.Generic.List`1[T] matchedSelectors, UnityEngine.UIElements.StyleMatchingContext context, System.String input, UnityEngine.UIElements.StyleSheets.SelectorMatchRecord& record) (at <e11cddb636f444f68eec62123764f018>:0)
    3. UnityEngine.UIElements.StyleSheets.StyleSelectorHelper.FindMatches (UnityEngine.UIElements.StyleMatchingContext context, System.Collections.Generic.List`1[T] matchedSelectors) (at <e11cddb636f444f68eec62123764f018>:0)
    4. UnityEngine.UIElements.VisualTreeStyleUpdaterTraversal.TraverseRecursive (UnityEngine.UIElements.VisualElement element, System.Int32 depth) (at <e11cddb636f444f68eec62123764f018>:0)
    5. UnityEngine.UIElements.StyleSheets.HierarchyTraversal.Traverse (UnityEngine.UIElements.VisualElement element) (at <e11cddb636f444f68eec62123764f018>:0)
    6. UnityEngine.UIElements.VisualTreeStyleUpdater.ApplyStyles () (at <e11cddb636f444f68eec62123764f018>:0)
    7. UnityEngine.UIElements.VisualTreeStyleUpdater.Update () (at <e11cddb636f444f68eec62123764f018>:0)
    8. UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <e11cddb636f444f68eec62123764f018>:0)
    9. UnityEngine.UIElements.Panel.UpdateForRepaint () (at <e11cddb636f444f68eec62123764f018>:0)
    10. UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <e11cddb636f444f68eec62123764f018>:0)
    11. UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <e11cddb636f444f68eec62123764f018>:0)
    12. UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <e11cddb636f444f68eec62123764f018>:0)
    13. UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <e11cddb636f444f68eec62123764f018>:0)
    14. UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <e11cddb636f444f68eec62123764f018>:0)
    15. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <2500dd078a544a69b6c923861af6cd15>:0)
    16.  
     
    Twanner likes this.
  2. DiegoDePalacio

    DiegoDePalacio

    Unity Technologies

    Joined:
    Oct 28, 2009
    Posts:
    507
    Hi @Amon,

    I was about to suggest deleting the Library and Temps folders before reopening your project again, but if this is happening even on an empty new project, it seems more like a bug to me.

    Would you mind reporting it following these instructions: https://unity3d.com/unity/qa/bug-reporting?

    In that way, we can check what's happening in more depth, and found the right fix.


    Thank you!
     
    Twanner and Amon like this.
  3. Amon

    Amon

    Joined:
    Oct 18, 2009
    Posts:
    1,384
    I'll do that now, thanks.
     
    DiegoDePalacio likes this.
  4. Amon

    Amon

    Joined:
    Oct 18, 2009
    Posts:
    1,384
    As posted in the Bug Report, this seems to go way out of control and bomb the whole editor when you open a project or start a new one and the update check window appears before the editor is loaded. Untitled.jpg
     
  5. KrispyKliff

    KrispyKliff

    Joined:
    Dec 8, 2020
    Posts:
    1
    I get the same error when I go to press play on a project :/

    Just another reason why 2020 sucks
     
    Last edited: Dec 8, 2020
  6. bahaagh7

    bahaagh7

    Joined:
    Aug 29, 2019
    Posts:
    6
    I got this error too.
    Please help.
     
  7. yulu54

    yulu54

    Joined:
    Mar 21, 2020
    Posts:
    1
    ı got this error too.
     
  8. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
    2020.1.12f1 same issue
     
  9. ttank7

    ttank7

    Joined:
    Apr 18, 2011
    Posts:
    42
    Same thing happening here. Lots of stuff is not being null checked sufficiently.
     
  10. kantagara

    kantagara

    Joined:
    Sep 15, 2014
    Posts:
    14
    Same thing happens here with that update check window being broken
     
  11. Deleted User

    Deleted User

    Guest

    same, the Unity Editor Update Check window thingy is happening to me too
     
  12. DCZT_97

    DCZT_97

    Joined:
    Jun 23, 2020
    Posts:
    3
    I just found out a solution, try it out if it works for you. Worked for me. So first go to your local disk then to Users, after that click on your name then AppData, then Roamingm, then find Unity folder and go into that folder, Go to folder named: "Editor - 5x", then go to preferences, then open a folder called layout, then folder called default and then open a text document with the name Default, in theat document press "ctrl+a", then press "ctrl+c", after that go to your folder with your project or game in it, then click on Library and open a text document called CurrentLayout-default and delete everything in there with "ctrl+a" and "del" and then just paste what you copied, so click "ctrl+v", Hope this works for you...
     
    pencil1, NPC0123, M_as and 17 others like this.
  13. NerdKvothe

    NerdKvothe

    Joined:
    Dec 8, 2020
    Posts:
    2
    This worked for me too. Thanks.
     
    mikeyng, DerBears and RodHill like this.
  14. Stonemass

    Stonemass

    Joined:
    Mar 28, 2015
    Posts:
    22
    unity is really amazing....just opening the editor u get errors.....
     
  15. reckoning47

    reckoning47

    Joined:
    Aug 13, 2017
    Posts:
    1
    Bump this, having an issue using 2019.4.16f1 as well
     
    khnivlam likes this.
  16. unity_hEYBOjNd63_wXA

    unity_hEYBOjNd63_wXA

    Joined:
    Jan 5, 2021
    Posts:
    1
    Thank you very much, it works! Great!
     
  17. yaxamie

    yaxamie

    Joined:
    Mar 11, 2017
    Posts:
    8
    Worked for me too. I think I've lost more time to Windows layout issues than any other editor bugs in the last year.
     
    DerBears likes this.
  18. gm_ek

    gm_ek

    Joined:
    Dec 30, 2019
    Posts:
    1
    Fixed the problem, thanks!
     
  19. Delvarn

    Delvarn

    Joined:
    Apr 6, 2020
    Posts:
    10
    Give this guy a MEDAL!
     
    ToadMedicine and DerBears like this.
  20. asad9habib7

    asad9habib7

    Joined:
    Dec 8, 2020
    Posts:
    1
    excellent
     
  21. Mognatti

    Mognatti

    Joined:
    Jan 22, 2021
    Posts:
    1
    Works like a charm <3
     
  22. DerBears

    DerBears

    Joined:
    Jun 3, 2018
    Posts:
    4
    This was making me crazy, thank you so much for the fix. Can confirm that it worked for me just now! I deeply appreciate you including the pathing for these folders as sometimes it seems people just assume we know these things by heart when we've never had to see these folders before and so leave out half of the information needed :)
     
  23. drin1drin

    drin1drin

    Joined:
    Jun 8, 2020
    Posts:
    10
    I don't have 'CurrentLayout-default' as text document but I have CurrentLayout-default.dwlt ...so now what ? :)
     
  24. mgsanders100

    mgsanders100

    Joined:
    Mar 30, 2014
    Posts:
    1
    To fix this issue, I just removed all my custom layouts by clicking the 'layout tab' - 'revert factory settings'. It only took me a minute to rebuild my custom layout so no real loss there. No issues since. From what I can tell, the issue stemmed from me deleting a custom editor UI element whilst still trying to access the custom layout it was saved to.
     
  25. josephzli2011

    josephzli2011

    Joined:
    Jul 1, 2020
    Posts:
    4
    This worked for me! Thank you for your answer.
     
  26. ziyadedris

    ziyadedris

    Joined:
    Mar 11, 2021
    Posts:
    8
    Still don't understand ):
     
  27. Clevereen

    Clevereen

    Joined:
    Apr 22, 2018
    Posts:
    8

    Give this man an honor medal, works perfectly
     
    ToadMedicine likes this.
  28. ToadMedicine

    ToadMedicine

    Joined:
    Jul 5, 2020
    Posts:
    2
    Still working after all this time lol. What a pain