Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Unity 2022.2 is now available as the latest Tech release.
    Dismiss Notice
  3. We are making some changes to the DOTS forums.
    Dismiss Notice
  4. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  5. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    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,022
    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,663
    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:
    221
  5. a436t4ataf

    a436t4ataf

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

    andersemil

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

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,663
    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.