Search Unity

How to block the inspector from repainting

Discussion in 'Editor & General Support' started by Wahooney, Dec 1, 2021.

  1. Wahooney

    Wahooney

    Joined:
    Mar 8, 2010
    Posts:
    281
    My script lets the user make changes to their scene in a constant fashion, but every time they make a modification it redraws the inspector, which is quite intensive. Is there something similar to RequiresConstantRepaint() that I can override to block repaints?

    I can add a bool that will block the whole OnInspectorGUI, but that feels VERY hacky. I'd rather it just stays how it is without redrawing.

    And the insane solution is to somehow draw the inspector to an offscreen surface, then just draw that when the user is busy. I don't want to do that.
     
  2. MvNimwegen

    MvNimwegen

    Joined:
    Dec 19, 2019
    Posts:
    56
    I do not think that this is possible, due to the very nature of the IMGUI system. I can think of at least 2 things you can do here.
    The first is simple. What is so intensive about your inspector? And can you buffer something instead of trying to (re)calculate things on every frame? Maybe you can better think on how to get the inspector more performant rather than blocking redraws.
    Second is not so simple, and that is UIE inspectors. These will only redraw when you tell them to.