Search Unity

Custom PropertyDrawer causes inspector window to be repainted constantly - what is going wrong?

Discussion in 'Immediate Mode GUI (IMGUI)' started by Xarbrough, Jun 20, 2019.

  1. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    I've already reported a pretty exotic issue (1164071) about the inspector window being constantly refreshed when using a custom PropertyDrawer with a very specific class setup.

    However, now I'm running into this issue with other configurations as well and wanted to know if this is something anyone from the community has experienced and can maybe tell me what is going wrong.

    I have a simple MonoBehaviour and a regular serializable C# class. The component has a serialized field of the custom class type and there is a PropertyDrawer to draw the class type.

    In my test setup I have nothing going on (no other fields, no actual drawing code in the drawer, it simply exists and has an empty OnGUI method), but the inspector window is constantly repainted every frame in the editor. I can tell from the blinking indicators in the internal developer mode and because the profiler shows a performance drop.

    And here comes the fun part: If I rename my component class to something else, the problem disappears, but it's not linked to any specific name. My reported bug hat the "SplineRenderer" component being repainted all the time, and renaming it to "SplineRenderer2" fixed the issue. But this morning I saw the problem in the "Cableway" component and renamed it to "Cableway2" and again it fixed the issue. Deleting the library also seems to resolve the bug, but I've already done that yesterday.

    It's hard to pin down what is causing this issue, since it is so specific and the profiler doesn't show who is responsible for triggering the redraw, but maybe somebody else has had similar experiences and can share observations.