Update in editmode

I am implementing a tool for painting splatmaps in Unity, but I got trouble in dealing with brush opacity. If you just click and hold down your mousebutton with 30% opacity the color should increase over time.
But since OnSceneGUI does not update unless sth. changes, it seems impossible to do that.
Is it possible somehow to update OnSceneGUI() or a different function in editor regulary?
Its also a problem to get the timing right in editmode. I tried it with:

double current = EditorApplication.timeSinceStartup;
deltaTime = (float)(current - lastTime);
lastTime = current;

but it seems like it does not work that well. Btw. even on the terrain its impossible to paint without moving the brush. But at least the got the timing right.

Unity provides the EditorApplication.Update delegate you can hook up to. It functions just like the Update in MonoBehaviours.

You add your methods to the delegate by

void OnEnable(){
    EditorApplication.Update += MyUpdate;
}
void MyUpdate(){}

removing works the same way, except with a “-” sign instead of “+”.

If you want to find out more about delegates and events, have a look at This Answer