How to force Debug Logs to be displayed when using a InspectorGUI script call ?

Hi, I have made a InspectorGUI tool which does assets updates on texture importers.
My problem is that the process is applied to texture directories and can take up to several minutes, and all my logs are displayed after it’s finished and not during the process.
How could I change that ?
Thanks !

Maybe you can use a Coroutine or the Update in a script which controls the process and which is marked as ExecuteInEditMode

Well, as you know the scripting in Unity is mainly single threaded and run on the main thread. However the whole repaint of the editor is also done on the main thread. If you block the main thread nothing has the chance to be updated until you give the control back to Unity. Coroutines do not work in edit mode as the coroutine scheduler only runs at runtime. However you could use a simplified manual approach. Just put your long process into an iterator block and add some yield return null; in between. This IEnumerator instance can be “iterated” manually inside the EditorApplication.update delegate for example.

Note that for long processes Unity has the EditorUtility.DisplayProgressBar or even EditorUtility.DisplayCancelableProgressBar. This progress bar will show in a modal window on top of the editor. It can be updated by calling the method again with new information. When the process is finished you need to call EditorUtility.ClearProgressBar.

Note that the progressbar is usually the preferred way for things that must not be interrupted. When you use the generic update delegate Unity is actually responsive and the user can mess around with the editor while your task is still running. This could even mean that a script recompile is done and your process will be terminated in between. If you want to go the update / interactive route you may want to ensure your task survives an assembly reload which can get quite tricky. Without more details about what kind of information each task requires we can’t suggest any specific solution.

Thanks for your answer. I’m going to test ASAP (currently installing Unity 2018.2)