OdinMenuEditorWindow Very high CPU usage issue

Issue #903 new
Ben Jackson created an issue

What happened? OdinMenuEditorWindow exhibits very high cpu utilization (~50%) when a selected menu item has no content (e.g. the parent node of child nodes) or no item is selected at all. Note this occurs when the Unity Editor interaction mode is set to either ‘default’ or ‘no throttling’ (mode 'monitor refresh rate' acts as a work around for this issue). See profiler screen shots below:

How can we reproduce it? This can be seen in a stock Odin installation. Go to ‘Tools->Odin->Inspector->Attribute Overview’. Select the ‘Essentials' node and observe cpu usage (very high). In contrast, select a node with content (e.g. ‘Assets only’) - observe expected low cpu usage.

Alternatively, see very simple repo below.

If screenshots would help explain or demonstrate your issue, please include these.

What version of Unity are you using? 2022.1.13f1.3513

What version of Odin are you using? (See "Tools > Odin Inspector > About") 3.1.10 & 3.1.2

Do you have Editor Only mode enabled? No

What operating system are you on? Windows 10 (build 19044)

using Sirenix.OdinInspector.Editor;
using Sirenix.OdinInspector;
using Sirenix.Utilities.Editor;
using Sirenix.Utilities;
using UnityEngine;
using UnityEditor;

public class CPU_UsageBugEditorWindow : OdinMenuEditorWindow
{
    [MenuItem("Tools/CPU Usage Issue Window")]
    private static void OpenWindow()
    {
        var window = GetWindow<CPU_UsageBugEditorWindow>();
        window.position = GUIHelper.GetEditorWindowRect().AlignCenter(800, 600);
    }

    protected override OdinMenuTree BuildMenuTree()
    {
        OdinMenuTree tree = new OdinMenuTree(supportsMultiSelect: true)
        {
            { "Parent Item with null content", null },
            { "Parent Item with null content/Child with content", new GUIContent("Hello World!") }
        };

        return tree;
    }
}

Comments (1)

  1. Log in to comment