Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

ClearPreviewCache error

Discussion in '2019.2 Beta' started by CoCoNutti, Jul 23, 2019.

  1. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    513
    I've just started getting the following error. I can correct it by deleting the Library folder of the project, but then it returns after a few plays in the editor. Is it me or is it a bug?

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.GameObjectInspector.ClearPreviewCache () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/GameObjectInspector.cs:211)
    3. UnityEditor.GameObjectInspector.OnDisable () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/GameObjectInspector.cs:199)
    4. UnityEditor.Rendering.LWRP.MaterialReimporter:ReimportAllMaterials()
    Thanks
     
    nick-morhun likes this.
  2. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    There's not enough information here to answer that question. What changed in your project before this issue started to appear? Could you please submit a bug report with a (minimal) reproduction project?
     
  3. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    I've just had this start occurring 100% of the time when I reload assemblies (i.e. any change to class files), and then invoke AssetDatabase.SaveAssets() during the reload callback (UnityEditor's EditorApplication.update)

    I've submitted a bug report: Case 1218243

    Seems to be that OnDisable's internal implementation crashes whenever OnDisable is called more than once in succession on the Unity internal class ... or: when OnDisable is called for a specific instance before OnEnable.

    One of my guesses is that something in UnityEditor is cloning in-memory objects (part of the new prefab stuff? multi-scene eidting? Both of those do a clone/reload of all objects at some points) and then the newly cloned / reloaded object is getting OnDisable call that should have been routed to the original - so it doesn't have a valid internal cache (which is only created after a successful OnEnable call).
     
    oscarAbraham likes this.
  4. oscarAbraham

    oscarAbraham

    Joined:
    Jan 7, 2013
    Posts:
    431
  5. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    andersemil and oscarAbraham like this.
  6. andersemil

    andersemil

    Joined:
    Feb 2, 2015
    Posts:
    112
    Happens several times a day here, 2018.4.9
     
  7. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,933
    Unity deleted my bug without looking at it, because 2018.4 was released.

    So go ahead and re-log this bug, but please cite "Case 1218243" - which shows it was broken since at least 2018.3.