Debug.Log for progress in editor
I am running large loops (taking around several minutes) in Editor script and looking how to print out the progress when loop is running. If I simply put Debug.Log() statement, everything gets printed at the end, when the loop is finished, while I would be interested to print out lets say iteration number when it's calculating to get the progress. Does anyone know if it's possible to do that?
Answer by BiomotionLab · Dec 03, 2019 at 10:16 PM
You could wrap it in a coroutine that takes an Action as a parameter. Then when complete it invokes the action. Then inside the loop you do a Debug log and then yield return null before the next loop.
Your answer
![](https://koobas.hobune.stream/wayback/20220612072403im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
activeInHierarchy code not being reflected correctly in Editor although debugging shows correct code 1 Answer
Playing from 64-bit Editor in 32-bit mode 0 Answers
Change debug level in inspector 0 Answers
How to generate a .pdb (debug symbols) for 3rd party code? 1 Answer
Unity: How to Relaunch WebGL Build From Within Editor 0 Answers