I have an addon (Colorful) which can change the colors of windows and bars. The colors are reset after each UI reload. Therefore, I am setting the colors from saved variables during the OnInitialize function.
The problem is, some windows are not created at this time. Therefore, I can't set the colors of those windows. I couldn't find an event for window creation. So, I use the OnUpdate function to check if window is created yet. I check this every two second.
When the colors of the all windows are set, I don't need this OnUpdate function any more. This is called very often (after every frame I guess). Thus, when I am done with it, I assign an empty method as my OnUpdate function. Even though the method is empty, I would rather unregister this OnUpdate completely. Is there any way to do this?
You can register the onUpdate Event via RegisterEventHandler( SystemData.Events.UPDATE_PROCESSED, "myFunc" ) only if you do it that way you can later call UnregisterEventHandler( SystemData.Events.UPDATE_PROCESSED ) to discard the event handler.