Texture2D in ScriptableObject’s Property drawer experiences serious lag

This is a bug as a consequence of an implementation detail in Unity.

What is happening here is that Unity internally has a concept of what are called optimized GUI blocks in the Inspector. The idea is that the Editor tries to avoid redrawing stuff unnecessarily unless the user actually changes/interacts with something. This optimization helps tremendously with things like big arrays.

Whenever users define their own custom Editors, this code path is effectively ignored, because we don’t want to make assumptions about what might need to be updated in the user’s Editor.

Right now, textures drawn with GUI.DrawTexture (which is what this thumbnail uses internally) do not properly register themselves with the optimized GUI block. (The same goes for some things like Handles.) I’m looking into it, but it’s unfortunately not a trivial fix. On the plus side, 2017.3 adds a method to PropertyDrawer, CanCacheInspectorGUI(), which you can override to disable the optimized path for individual property drawers. I confirmed that it fixes the problem in this case.