I’m using the AnimationUtility to modify animation curves as they’re being edited. However, when I do this - using AnimationUtility.SetEditorCurve - there’s no feedback whatsoever on the window. Even clicking in the window doesn’t update the animation displayed - it seems to only update when the user tabs back and forth between the curve/dopesheet view. Is there a way to force it to repaint completely?
In addition, it would be really nice to be able to see (in script) which AnimationClip the user is editing right now. But that does not appear to be possible.
Finally, modifying curves through SetEditorCurve seems to be incredibly glitchy. Sometimes the curves are changed - sometimes they aren’t. Sometimes they revert to their previous state after I change them in script. Has anyone ever actually successfully used this API? Any pointers? It’s a nightmare.
Just force a repaint. If it is your own Editor Window call repaint. If not you can try to grab the one in focus and repaint.
EditorWindow.focusedWindow.Repaint();
You are able to track which control is currently being modified using the following two values. Keep in mind all Unity uses to keep track of the controls is an int. That int is set in the order that they are renderered.
That’s why I said if not grab the one you want and repaint it. You have the power to get anything that Unity draws. Since the type is internal you can’t directly search for it. You can however grab every Editor Window type and filter the results. Store that instance and refresh it when need be.