FadeGroups lag when run through an Editor class

Issue #105 resolved
Scott Richmond created an issue

Using a dead simple custom Editor class to draw a type and let Odin draw some properties within it seems to cause FadeGroups to lag and sometimes stop mid-fade.

GIF.gif

This gif is not lagging, this is exactly how it looks. Whenever it stops, I need to click somewhere to force a repaint.

    [CustomEditor(typeof(BlueprintContainer))]
    public class BlueprintContainerEditor : Editor
    {
        private PropertyTree tree;
        //private IEnumerable<Type> _componentTypes;

        public override void OnInspectorGUI()
        {
            //Make sure you have an Odin property tree
            if (tree == null)
            {
                tree = PropertyTree.Create(serializedObject);
                //_componentTypes = GetComponentTypes();
            }

            //base.OnInspectorGUI();

            tree.Draw(true); // Draw Odin

            //AddComponentButton();
        }
}

The reason I'm using an Editor is to I can draw a special button at the bottom of the inspector. I have commented all that out for testing purposes with no change to the issue.

Comments (3)

  1. Bjarke Elias

    You simply need to repaint the EditorWindow.

    There are two relevant methods for this in the Sirenix.Utilities.Editor.GUIHelper class; RequestRepaint and an extension method called RepaintIfRequested, which you can call at the end of your OnInspectorGUI method:

        [CustomEditor(typeof(BlueprintContainer))]
        public class BlueprintContainerEditor : Editor
        {
            private PropertyTree tree;
            //private IEnumerable<Type> _componentTypes;
    
            public override void OnInspectorGUI()
            {
                //Make sure you have an Odin property tree
                if (tree == null)
                {
                    tree = PropertyTree.Create(serializedObject);
                    //_componentTypes = GetComponentTypes();
                }
    
                //base.OnInspectorGUI();
    
                tree.Draw(true); // Draw Odin
    
                this.RepaintIfRequested();
    
                //AddComponentButton();
            }
        }
    
  2. Log in to comment