OnValueChanged Does Not Repaint Game or Scene View

Issue #348 wontfix
Former user created an issue

The OnValueChanged attribute will successfully call a method, however Odin Inspector will not repaint the scene or game view afterwards. We have to click on or resize the editor windows to cause a refresh to occur.

To reproduce, create a string and set it's OnValueChanged attribute to a method that will update the visual component of a Unity UI text component to the latest text.

You can see that the OnValueChanged method is being called, but the Unity Editor Scene & Game view are always one update behind, and for some other field types (such as color), you will never see the Scene or Game view update.

Using Unity 2017.4.1f1 and Odin 1.0.6.9.

Editor only mode is not enabled.

Experienced on a Windows 10 home edition PC.

To discuss further or request an example project, contact me at derrickbarra@brandvr.co.

Comments (3)

  1. Tor Esa Vestergaard

    Odin only triggers a repaint of the window in which the OnValueChanged invoke was run, nothing more. Odin cannot know what has to be updated after such a call, as completely arbitrary code can run in it.

    And, I'm sorry, but nor do I think Odin should request a repaint of literally everything, everywhere, every time it invokes a method that might change things. It is far more reliable and sensible, if instead, when you yourself are triggering a change that needs such an update outside the scope of the current window, then you yourself force the repaint of the necessary elements.

  2. Tor Esa Vestergaard

    An easy way to force a repaint of everything would be something like the following code - have this as a utility method somewhere and invoke it when you want to force repaint absolutely everything:

    public static void ForceRepaintAllWindows()
    {
        foreach (var window in Resources.FindObjectsOfTypeAll<EditorWindow>())
        {
            if (window)
            {
                window.Repaint();
            }
        }
    }
    

  3. Log in to comment