Unity seems to crash after showing a progress bar

Hi all,

I’m having Unity crash whenever it shows a progress bar on OSX. Including when trying to build. I get the exact same call stack as in this issue, however it was marked as not reproducible. On Windows there are no issues.

public class MapGeneratorProgressBar : EditorWindow {
    public static bool IsRunning;
   
    public static int CompletedSprites;
    public static int TotalSprites;
   
    public static string ProgressDescription;
    static double Progress { get { return (double)CompletedSprites / TotalSprites; }}
   
    public static void Show(int total) {
        IsRunning = true;
       
        CompletedSprites = 0;
        TotalSprites = total;
       
        GetWindow().Show();
    }

    static EditorWindow GetWindow() {
        EditorWindow window = GetWindow(typeof(MapGeneratorProgressBar));
        window.minSize = window.maxSize = new Vector2(1, 1);
       
        Rect position = window.position;
        position.center = new Rect(0f, 0f, Screen.currentResolution.width, Screen.currentResolution.height).center;
       
        window.position = position;
       
        return window;
    }

    void OnGUI() {
        if (!IsRunning || Progress >= 1) {
            IsRunning = false;
           
            EditorUtility.ClearProgressBar();
            GetWindow().Close();

            EditorApplication.Beep();
            EditorUtility.DisplayDialog("Complete", "Map generation has completed.", "OK");
           
            return;
        }
       
        if (EditorUtility.DisplayCancelableProgressBar("Generating Map", ProgressDescription, (float)Progress)) {
            IsRunning = false;
        }
    }

    void Update() {
        UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
    }
}

The crash happens after I press “OK” on the dialog when complete. So I can still save my scene before pressing it. However I am currently unable to build from my OSX installation.

Is anyone else experiencing this? I was getting it in 2017.3.0 and just tried upgrading to 2017.3.1 however the issue remains.

Hi , gumboots!
I repeated your crash on Mac with Standart Unity Example. (Unity 2017.3.1.p1) I solved it removed this call
EditorUtility.DisplayCancelableProgressBar
from EditorWindow class and added to a simple class with subscription on ChangedValue event from some IProgressReporter callback. And EditorUtility.DisplayCancelableProgressBar became to work good!

Hi @FoxsterDevPlaytika , thanks for this. Would you be able to post a code example? I’d love to see exactly how you got it working!

Hi, @gumboots ! You can see here. If you download all scripts from Editor/Coroutine , you can test this from Unity Menu/Tools/
Tests/Show Progress Bar Waiting for time. I hope it helps you:)

Thanks very much @FoxsterDevPlaytika !