Search Unity

  1. Curious about what's going to be in 2021.1? Have a look at the 2021.1 beta blog post.
    Dismiss Notice

Bug EditorUtility.DisplayProgressBar not showing up anymore

Discussion in '2020.1 Beta' started by ImpossibleRobert, Jul 15, 2020.

  1. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    346
    Is this a known bug? I have an editor script which worked just fine in 2019.4 and in 2020.1.b16 the progressbad is not displayed anymore in the GUI.
     
  2. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    961
  3. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    961
    From release notes:
    Hmm. This is strange. Like I mentioned, maybe its not the a good use of the progress bar.. but if any editor tools depended on the progress bar as a way of preventing users input until a process is complete, there is a small window of time where those scripts might run into some problems. We were also using it as a way of showing the user that their action was acknowledged and was being worked on right now.
     
  4. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    346
    I had opened a bug for it yesterday: 1264191
     
    LeonhardP, Peter77 and Prodigga like this.
  5. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,524
    That would be the case only if that editor tool runs in parallel, like on another thread?

    I would assume the change still blocks the main thread for those first 0.3s, because it's very simple to implement it that way, but it's not blocking anymore?

    I find this change very interesting, because I wrote a "Reporting UI progress properly in Unity" article a few years ago and it seems it's exactly what they implemented now.
    http://web.archive.org/web/20160804220745/http://console-dev.de/?p=447
     
    Last edited: Jul 19, 2020
  6. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    961
    Yeah, that is the case for me (Web requests, file uploads, etc)
     
    ImpossibleRobert and Peter77 like this.
  7. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    346
    I also use it for file upload that runs async. The state is all shown correctly (eg buttons disabled) just the progress does not pop up anymore as it did in 2019.3
     
    Peter77 likes this.
  8. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    346
    Just educated guessing, but @Aras could this be a potential side-effect of what I think your team has done with the nice progress popup that now shows more info while Unity is busy?
     
  9. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    346
  10. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,659
    Hmm yeah so the issue is that this API was only ever mean to be used for "blocking" operations, i.e. where the control never returns to Unity for the duration of the progress bar. Doing it from inside OnGUI does return control to Unity though, at which point (due to the new "busy" progress bar in 2020.1) the code goes "ha! I'm no longer not-responding! no need to keep on showing the progress bar"

    For "background" operations in the editor, the https://docs.unity3d.com/2020.1/Documentation/ScriptReference/Progress.html class is what you most likely want to use.
     
    TerraUnity and ImpossibleRobert like this.
  11. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    346
    I just changed it to the new Progess() mechanism. This is so much cooler!! And looks way more professional. Thanks for providing this.
     
    LeonhardP and Peter77 like this.
  12. moose0847

    moose0847

    Joined:
    Dec 26, 2019
    Posts:
    17
    Is there any existing documentation on this busy progress bar? I'm seeing a similar issue where I need to perform a blocking operation in the editor, but EditorUtility.DisplayProgressBar isn't drawing anything.
     
  13. thesanketkale

    thesanketkale

    Joined:
    Dec 14, 2016
    Posts:
    49
    @Aras, all the background operations gets canceled when the editor enters play mode. What to do if a file upload operation needs to be blocking until it is running? (Like not get auto cancelled by doing something else in the editor)
     
  14. thesanketkale

    thesanketkale

    Joined:
    Dec 14, 2016
    Posts:
    49
    Anyone? Please tell me if this is possible or not. The new background process in 2020 is good, but if by mistake the user hits the play button in the editor, the background process shuts down. How can I work around this to ask the user to wait until the process completes or keep the process running in background?

    I am not able to find much information on this in the Unity Docs.
     
    hand-baba-shouta likes this.
  15. Flying_Banana

    Flying_Banana

    Joined:
    Jun 19, 2019
    Posts:
    18
    In a blocking call, we can't update the progress of the current progress bar, but if we use EditorCoroutines, we lose the ability to block the user from performing potentially conflicting operations while the task is being performed. Any way to do a blocking task while also updating the progress bar?
     
    Prodigga likes this.
  16. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    961
    Yeah I need to block the editor while I am doing some work. I have an async method that does a bunch of stuff over the course of a few frames in the editor (web requests, configuring some services). during this time I want to prevent the user from clicking around the editor, so I want to display the progress bar. I want it shown when I 'display progress bar', and I want it gone only when I call 'clear progress bar'.

    The new progress bar changes are confusing. The progress bar is trying to be too clever, and not allowing me to drive it the way I want. I want to drive the blocking progress bar popup window myself fully and completely.

    'EditorUtility.DisplayProgressBar' is no longer a command but a suggestion, and this kinda sucks.

    @Aras
     
    Last edited: Oct 26, 2020
  17. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    961
    bump I guess. I need a way to block the editor from input until I am done doing what I need to do. otherwise I need to write a lot of code to work around the fact that the user might perform some action (like hitting play) and interrupt what I am trying to do.

    I understand this is a heavy handed solution (to block the entire editor), but this is for internal tools and we are a small team. It saves us a lot of work to just be able to suspend the editor until our work is done.
     
  18. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    701
    Just curious: if you want to block the entire editor anyway, why use an async method? If you want to be heavy handed, do it on the main thread and block the editor.
     
  19. Flying_Banana

    Flying_Banana

    Joined:
    Jun 19, 2019
    Posts:
    18
    Because you want to show a progress bar if the task takes a while. Currently the progress bar won't update if you do a blocking call.
     
    Deozaan likes this.
  20. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    961
    In my case, I have a few Async methods that I need to chain together. Async/await is really easy to work with. I have an Async method to perform some git operations, another to launch a local nodejs server and wait for it to start listening so I can test locally, and another case where I want to perform a few http client Async web requests. It's just easier and cleaner to write Async/await code.

    Problem is the editor isn't really frozen when I am doing these things and the progress bar Api refuses to let me block input like it used to.
     
    Deozaan likes this.
  21. moose0847

    moose0847

    Joined:
    Dec 26, 2019
    Posts:
    17
  22. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    591
    The forums are not a good avenue for feedback, it's up to luck if the right Unity developer checks it and many times they don't. The encouraged way is to file bug reports for everything, this gets your feedback into Unity's system and makes sure it's looked at. All of you having a specific use-case should report a bug with it.

    Not in my experience. You just call
    EditorUtility.DisplayProgressBar
    periodically in your blocking code and the progress bar gets updated fine.
     
    Prodigga and Peter77 like this.
  23. moose0847

    moose0847

    Joined:
    Dec 26, 2019
    Posts:
    17
    @Adrian is there a ticketing system or site somewhere? I looked around and every link eventually pushed me to a forum post that said feature requests should be added in as forum posts.

    Also regarding your experience what do you mean by "in your blocking code"? Do you just run a while loop and create a stall in the program?
     
  24. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    591
    @moose0847 AFAIK there are no Unity people hired to collect feedback and reports from the forums. The devs that do check the forum do it voluntarily and often irregularly. There's the public issue tracker but that's mostly for checking the state of current issues. The actual issue tracker is private and you can only submit bug from the editor. The bug reporter is maybe not the right avenue for requesting new features but in this case, where they changed an existing feature and you can create a repo case illustrating how you want to use it and why it's not working, I think it has the most prospects.

    I'm using the progress bar when doing batch asset processing that's blocking the editor and update the progress bar in-between. The article @Peter77 posted earlier shows good examples of how it's supposed to be used.
     
unityunity