Search Unity

Bug Waiting for Unity's code to finish executing

Discussion in 'Editor & General Support' started by blockimperium, Nov 19, 2021.

  1. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    304
    The issue we’re discussing here is an editor related issue. Nothing to do with objects in a scene or an infinite loop.
    This is an Editor compile time issue that is driving a lot of people crazy. Unity better fix this or else anyone working on a large project is going to have to seriously consider other options.
     
    ImaGyn and stefanutz1504 like this.
  2. PanderaStudios

    PanderaStudios

    Joined:
    May 27, 2017
    Posts:
    4
    The strange thing is that I have other projects that run without this problem.
     
  3. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    304
    It seems to be larger projects that are affected
     
    Anonym1414 and stefanutz1504 like this.
  4. goodnewsjimdotcom

    goodnewsjimdotcom

    Joined:
    May 24, 2017
    Posts:
    342
    Right, The load in question happens not even at a compile, Unity just busts into it and never exits.
     
  5. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    Same issue... Unity 2021.3.8 . All of a sudden this started to pop up everytime I go into Playmode

    Why hasnt Unity acknowledged the issue yet!
    uity 4ever.PNG
     
    Roman_34 likes this.
  6. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    I found this is happening after using bunch of hinge joints. Anyone else using it?
     
  7. Homicide

    Homicide

    Joined:
    Oct 11, 2012
    Posts:
    657
    So i just skimmed this thread really fast, and this may not apply to all or any, but i was reading another thread in search of answers to unitys constant progression towards slower and slower recompiles after script changes etc... it just gets obnoxious.

    Long story short, i was experiencing unity taking extreme time between script changes , play mode entry , etc etc, always with 'rebuild domain' and other crap unity spits out on the progress bar. It seemed the longer my unity session the worse it gets over time too. I would see it start at 6, 12, 15 seconds, and end up at 30 - 46 - 1:02 and climbing, it was appauling.

    Another user suggested disabling Directory Monitoring and Asset Refresh (found in Preferences/Asset Pipeline), and lo and behold, i have not experiences any progress bar lasting more than a few seconds. Note** if you do this, you will have to Ctrl + R after any scripting and changes etc. Small price to pay for 500% faster environment.

    Ofc, this may or may not help anyone here, but it did for me with some of the things i think i am seeing here.
     
    Norgar and aloften like this.
  8. aloften

    aloften

    Joined:
    Aug 25, 2017
    Posts:
    18
    This is the worst thing ever. Like seriously...its making unity completely useless for me. I add ONE new variable that is serialized and I have a several minute wait. If I open the preferences, several minute wait. If I click on a prefab to edit something several minute wait. Clicking play mode, immediately after having a several minute wait, causes a wait. CLICKING TO A WEB BROWSER TO PASS THE TIME WHILE WAITING AND CLICKING BACK WILL SOMETIMES RESTART THE WAIT!

    Dont even get me started on what happens if it tries to trigger while youre moving a file. Cleaning up your directory is almost a mistake. Dragging a file into a folder, then selecting other files, if you drag the new files toward a folder and the wait message pops up, it will sometimes DUPLICATE all the files you are dragging.

    This is insane.

    I am, without a doubt, spending more time waiting than developing. This is a shame...A gosh darn shame. Im even forgetting what I was about to do, because of really long waits.

    Recommended functionality - go into play mode to reload scripts. BUT ONLY RELOAD IF THE DIRECTORY HAS A NEW FILES IN IT! I seriously dont understand why it even NEEDS to reload ALL things. What if you only reloaded related things?! I mean...is that so crazy?

    I love unity...please fix this.
     
    dbattista11 likes this.
  9. aloften

    aloften

    Joined:
    Aug 25, 2017
    Posts:
    18
    I couldnt get this to work at first. I had to close and reopen the editor. Thank you for this solution. It works great because you dont HAVE to rebuild unless you go into play mode making it the best solution because you dont even need to remember the shortcut.

    This is acceptable for now. Seriously...A lot of people dream of being a game developer and unity is a prominent tool in the field. Causing the wait times to be longer than the time spent in development will discourage a lot of people. Time/effort vs results - there is a delicate balance.
     
    Last edited: Oct 8, 2022
    Anonym1414 and Homicide like this.
  10. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,340
    I think the problem is not the bug itself, is the Unity mentality of moving to newer versions and adding features than assign those teams to fix problems appearing 3 versions back, maybe in the hope that will be fixed by pure chance.

    We have a broken unity 2021 and the reveal of 2023, in my mind should have stopped at 2021 and fix all major issues before even think going to 2022 or add a single extra new feature.

    Increasing the complexity on a broken software before fixing it is never a good idea.
     
  11. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    The problem is that the user needs to produce the solutions themselves to these issues. With all respect to everyone who this issue effects, if you want to develop a good game using this framework you’ll have to be smarter about it.
    Unity 2019 when assembly times were nigh instant suffered from corrupted scenes and the like. Horrible things that would occur after a small code change. The way I dev my projects now I do not experience any slowdown or frustration regarding the script assemblies. You have to think about and consider the impact of your own project management on the engine that you are testing with. If your project is a mess using things like visual scripting package or containing thousands of individual scripts then of course you are going to effect editor performance. At the end of the day you need to weigh it up, what’s the most important thing? Editor performance or having a convenient place to dump every file you’ve ever created. In that context whose fault is it that the editor performance is bad? It is your fault for keeping expensive packages you don’t need or don’t use, or importing a metric tonne worth of assets just to use a small amount of them. The editor is not some magical work horse that can take abuse like that. There are solutions to this issue that do not require a new build of unity to address. Such as; an editor version of your project and then a build version of your project.
     
  12. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    304
    I get what you are saying @AnimalMan and you are right that our project is bloated and could be streamlined significantly. However, this was not an issue with the exact same project in 2020. When we upgraded to 2021 the significant editor lag appeared.
     
    Anonym1414 likes this.
  13. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,340
    And generally there were no issues whatsoever in Unity 2019, so is a combination of some changes after that version.

    Currently there is so many issues appearing in versions after 2019 that not appear in 2019, e.g. crashes from swapchain on heavy GPU load, infinite loops that make Unity stuck, erase of all assets when making a new project and reload it, increased shader compile times due to default to Async shade compile buggy mode, massive delays and popups that break the workflow etc

    Unity 2019 was the last perfect version, anything after that is just a broken system in my mind. They should just stop any action on making new Unity versions and features and focus all teams in fixing and optimizing Unity 2021.3 LTS line, which should be the ultimate priority if want to have any chance of recover the engine credibility as a stable platform to work on.

    Pushing out more and more broken new versions of Unity is not the way to go for sure.
     
    nathanjams likes this.
  14. ForgedPixels

    ForgedPixels

    Joined:
    Oct 17, 2022
    Posts:
    1
    This was exactly my problem. I had been trying for 2 hours to figure out the problem, read you response on here and it immediately clicked, I forgot the else statement in my IEnumerator. Works like a charm now. Thanks.
     
  15. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    304
    Again, not relevant to the topic of the conversation. That is a coding error in your script.
     
  16. DavidZobrist

    DavidZobrist

    Joined:
    Sep 3, 2017
    Posts:
    234
    Error pesist in 2021.3.11f1

    I did update 2 projects one from 2019 LTS and another from 2020 LTS

    And both take endless to enter playmode now.

    Info:

    • Working on Windows 10
    • Developer mode is off
    • I tried if deleting the library folder does the trick, it didnt.
    • All packages are updated to the newest version.
    • On both projects i did use the render pipeline converter to upgrade from previous URP to the new one.
    • The game start correctly when built to the device Pico Neo 3.
    • We do use OpenXR
    • Same issue appears on both unrelated project (except both are URP and OpenXR / VR)

    All worked fine in 2019 LTS


    EDIT SOLUTION:

    I restarted my pc.
    I went to XR Plug-In Management ->
    And for each platform disabled Initialize XR on Startup
    -> Entered playmode in 3 Seconds after hitting play

    After toggling it back on there was no more issue.


    Additional Information:
    The OpenXr plugin has the checkbox in the packagemanger aswell as other packages.
    But they are not uptodate! The update button was there...
     
    Last edited: Oct 17, 2022
    louspawn10, DEGUEKAS and richatd_q like this.
  17. samvid

    samvid

    Joined:
    Feb 25, 2016
    Posts:
    6
    I am having the same issues now. I am working on a medium size project and here are all the things I have tried:
    1. New scenes
    2. Blank New project
    3. Other Unity 2021.3.xx versions

    Nothing is working.
     
  18. SudoResolve

    SudoResolve

    Joined:
    Sep 7, 2022
    Posts:
    2
    This happens to me on Windows 10

    I even have 64GB of RAM. Still see 90%+ utilization when Unity hangs up. Happens with blank scenes, populated scenes, and doesn't matter what asset package I"m using.

    Terribly frustrating. 2021.3.10f1
     
    brunogattai1996 likes this.
  19. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,115
  20. msmoyle

    msmoyle

    Joined:
    Jul 15, 2013
    Posts:
    11
    Any time I try to use terrain tool box to edit terrain settings I get the waiting for code to execute and it never goes away.
    Even if I just test it on selected terrains with a single terrain tile.
    Task manager cant close unity like this so I have to shut my pc down every time it happens.
    This means I have to manually change each terrain which takes hours.
     
  21. bobtheangryflower

    bobtheangryflower

    Joined:
    Oct 25, 2022
    Posts:
    2
    Wow. I'm getting this with the very first Lego Microgame tutorial. Broken right out of the box. Are there heavy-duty Unity minimum specs I don't know about?
     
  22. DJ_Design

    DJ_Design

    Joined:
    Mar 14, 2013
    Posts:
    124


    The latest Unity LTS is unusable.

    People above getting frozen projects in the Lego Microgame Tutorial.. a tutorial to welcome new users to the engine? Welcome Indeed.

    I don't care, Jonathan Blow was right. Modern software is Joke .
     
  23. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,115
    unreal works fine for me.
     
  24. DJ_Design

    DJ_Design

    Joined:
    Mar 14, 2013
    Posts:
    124
    Is ue5 production ready yet?
    In reality I'm much more productive in Unity unfortunately.. or at least I used to be.
    Still, If the recommended LTS version isn't working, Unity engineers are just clowning on me at this point why am I still here? Clearly they want us gone. I thought LTS was supposed to be the safe option?
    Why am I not in beta, hell why not start a project in alpha? o_O
     
    Last edited: Oct 28, 2022
  25. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,115
    I've got to the conclusion that all these engines are never going to actually work 100%

    If you never worked with unreal prepare for at least 6 months of learning to figure out how all works. Unfortunately there is a lack of tutorials on how to do stuff properly there, is slowly improving but still.

    unity was fine and I like the 2D PSD package to rig 2D characters, this appears to not exist in unreal.

    Only issue I had right now with unity and was the last straw, was when the editor didn't saved the level. I can't trust this program, i don't know why and when this happens but once it happens it kills your soul. Hours lost, usually you wake up in the morning and all the work before is gone.

    For unreal i really like the blueprint setup, is quite difficult to work with code there. Is not so easy like on unity. That because it uses C++ that is a hell by itself with all those pointer around.

    Just for the sake of trying to understand once I've figured out the blueprint mode of work I've tried going back to unity and see how i can recreate stuff in bolt/visual studio.

    I like for example the fact that you can use unity visual studio to build code like you build the character animation graphs. You can jump from game state to game state.

    I didn't figure out same thing in unreal. they don't have that as far I can see right now
     
  26. DJ_Design

    DJ_Design

    Joined:
    Mar 14, 2013
    Posts:
    124


    I have experience with unreal 4, reading 5 is especially unstable atm with it being so early. The lighting/raytacing/compilation times etc so definitely not shippable I would wait a year or so to dive in fully yet.

    For me it's a tragedy because while everyone raves about blueprint nodes, I find them really icky with any real complexity.
    I would much prefer to use them for strictly cosmetics only, and just use C++ for real simulation logic as I have experience with that, and that sounds like what most studios do anyhow.

    Still, that combination of blueprints and C++ does not match unity C# + custom editor/inspector in my experience though, at least for me.
    And yes, I know the ancient argument "its an open engine build it yourself"

    The people that say that have never programmed an engine to function as they need it to.
    Unreal is a beast more built for teams, not small developers as friendly as the blueprints seem.

    I loved unity for being so accessible at the time, but it's no longer a net positive the time being spent waiting for answers I will never get.

    When I finally pull the trigger it will likely be a lot of painful grimacing, it is what it is and as productive as I once was in unity, the current state it's in is simply wasting my time.
     
    Last edited: Oct 30, 2022
  27. mightee-cactus

    mightee-cactus

    Joined:
    May 5, 2014
    Posts:
    1
    So I had infinitely "Waiting for Unity's code to finish executing" thing. Editor ver. 2021.3.10f1.

    Screenshot_4.png

    Turned out, in my case, editor was losing some package versions. Debugger showed SemVersionParser was stuck parsing empty string again and again, jumping between two exceptions that mutually lock each other into a loop.
    Screenshoots of both call stacks:
    Screenshot_3.png
    Screenshot_2.png

    SOLUTION to my problem: I removed folder root/Library/PackageCache and restarted editor.

    Issue still repeats, but at least I know how to deal with it.
    Unfortunately I couldn't target the package that "forgot" its version.
     
    heu3becteh likes this.
  28. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    304
    I did a fresh install of Windows 11 - system had been run for 3 years on the same install (including an upgrade from 10). Unity is running a lot better when editing in the Hierarchy window. Project window is still pretty annoying (one and a half minutes to rename a folder). This is in a 100 gig project that could be cleaned up but we're just trying to squeeze some life out of it before we move on.
     
  29. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    I like how UT just ignores this problem hoping it will go away by itself.
     
    Roman_34 likes this.
  30. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,115
    I'm curios if this is still present in the 2022 version or the 2023. Maybe they fixed that for these versions and only the old versions are broken.
     
  31. richatd_q

    richatd_q

    Joined:
    Dec 28, 2019
    Posts:
    1

    This worked for me, thanks!
     
    louspawn10 and DavidZobrist like this.
  32. stuart567

    stuart567

    Joined:
    Jun 21, 2017
    Posts:
    3
    You're a clever man.
     
  33. heu3becteh

    heu3becteh

    Joined:
    Aug 6, 2020
    Posts:
    25
    Had this issue.
    upload_2022-12-6_19-1-1.png

    Removing Library folder did help. Removing not the whole Library folder, but only PackageCache did cause errors.
     
    soberauer likes this.
  34. DavidZobrist

    DavidZobrist

    Joined:
    Sep 3, 2017
    Posts:
    234
    The bad thing about removing the lib folder is:

    It takes long to delete
    It takes long to rebuild
    And if you had build settings effecting all your assets like described here:
    https://forum.unity.com/threads/on-...ted-on-the-first-import.1369140/#post-8633343
    Than you get another long loading bar to import all assets once more.

    So a nicer fix ( official solution ) for this kind of issue would be appreciated.

    Edit: As for XR it most likely it has to do with ( as mentioned above)

    I went to XR Plug-In Management ->
    And for each platform disabled Initialize XR on Startup, played -> worked again
    enabled it again -> continues to work
     
    Last edited: Dec 8, 2022
  35. darkesco

    darkesco

    Joined:
    Mar 19, 2015
    Posts:
    61
    I've run into this issue at least 4 times over the past 10+ years. It generally happens after an update or change. The fix for me is always related to integration of Visual Studio, SDKs, Utilities, Packages, and/or external apps.

    Yesterday, after updating the project, I ran into this error again. Below are the first things I would try, and to my knowledge, they do not require you to scrap your project and start over. Most troubleshooting here is simple.

    Steps usually taken to resolve:
    1) Update Visual Studio to the latest version (Visual Studio Menu --> Help --> Check for Updates)
    2) Update Visual Code Editor and Visual Studio Editor (Unity Menu --> Window --> Package Manager)
    upload_2022-12-10_13-3-56.png
    3) Save/close everything and reboot the Computer
    4) Launch Unity Hub, then your project

    The above is probably enough to solve most issues ...however, for Android and/or poorly linked project Tools:
    After perform steps 1-3 above, ensure External Tools is setup properly. (Unity Menu: Edit --> Preferences --> External Tools.)
    Ensure JDK, NDK, SDK, etc., are all set up and will work with your Minimum and Target API.
    Note: Regenerate Project Files helps with multiple issues, such as when Visual Studio shows red underlines for most of your code. It may help with this issue, but I'm not sure. I just click it anyway.
    upload_2022-12-10_13-12-49.png

    Finally, if the project is VR, you will have to evaluate and update all external tools and integrations. Often, updating or reinstalling the tools will fix the issue. An example: Re-downloading and re-installing Oculus Desktop may fix issue with Play/Debug freezing or air link issues.

    The most important step here is to document the fix. Don't be stupid like me and spend multiple hours resolving this issue every time it happens.
     
  36. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,115
    You are not alone. Invested hours to fix something really arcane, a year later: "How did I fix this? I remember fixing this and even felt good about it for figuring it out!"
     
    darkesco likes this.
  37. OS13

    OS13

    Joined:
    Apr 10, 2016
    Posts:
    19
    Use Unity 2018 or 2019.
     
  38. hassancortex

    hassancortex

    Joined:
    Oct 27, 2019
    Posts:
    7
    My game had 5 scenes. 1 scene always got stuck on 'project browser.mousedown'
    I tried almost everything stated out here. Big thanks to all contributors.
    Nothing worked.
    Gladly I had a backup so I lost only 2hrs of work (and 2hrs of troubleshooting).
    Restored the scene from my backup folder and I was good.
    Moral - always have a backup (possibly after a successful build).
     
  39. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,115
    what did you do in those 2 hours? maybe we can figure out why it happened
     
  40. orchert16

    orchert16

    Joined:
    Apr 2, 2013
    Posts:
    2
    Oh Man!! This is a disaster. Is Unity addressing this problem? I'm getting Application.Updatescene error. Can't even open the project. Yikes!! Posting bugs goes unchallenged. What's a developer supposed to do now? Using 2021.3.15 going to try newer versions to see if this fixes this issue.
     
  41. URPian

    URPian

    Joined:
    Aug 13, 2012
    Posts:
    33
  42. wechat_os_Qy01gBBwLVoMcAysYgSvkFNrA

    wechat_os_Qy01gBBwLVoMcAysYgSvkFNrA

    Joined:
    Sep 3, 2022
    Posts:
    1
    try this: delete plastic4 in C:\Users\username\AppData\Local and it is recommanded to back up it before deleting :)
     
    Nintendo-Silence likes this.
  43. Bluephoenix-art

    Bluephoenix-art

    Joined:
    Aug 2, 2017
    Posts:
    1
    Try to terminate Node.js process
     
  44. Tentakero

    Tentakero

    Joined:
    Mar 5, 2017
    Posts:
    17
    I had this problem and it turned out to be that my code had a nested for loop with the wrong syntax. Think something like the j++ loop checking for i++ from the parent loop. Fixing that solved the issue for me but it does seem like others are getting this due to other reasons.
     
  45. WayetGangYT

    WayetGangYT

    Joined:
    Mar 22, 2023
    Posts:
    2
    Im already waiting 40 minutes for it to finish
     
  46. nubbyninja

    nubbyninja

    Joined:
    May 16, 2019
    Posts:
    25
    It would be very, very productive if we could have a setting to set a timeout for such processes, so in the event there is an infinite loop somewhere, or some problem with our code causing the editor to bug out forever, we can either a kill the process with a button or b have a finite time limit with a "max execution runtime limit reached" or some such.
     
    CloudyVR likes this.
  47. Wreckertike

    Wreckertike

    Joined:
    Feb 6, 2014
    Posts:
    7
    So if ever you in a disater situation with this. Kill Unity. Find a text file/script. Open that, edit it, just put something in. Save it. Edit it back to normal, save it. Open unity project. Something abt that seems to fix it and lets you back in.
     
  48. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,115
    you mean an existing script from the project?
     
  49. CortoMaltese

    CortoMaltese

    Joined:
    Jun 1, 2013
    Posts:
    1
    I had the same issue. I checked my breakpoints list. It contained some invalid breakpoints to files that were either deleted, renamed or moved to another folder. Deleting all these, the issue disappeared. I cannot know if this is a solution or a mere workaround, but you may try
     
    Davex6 and nasos_333 like this.
  50. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    715
    Infinite loop issue in Unity 2023, changing values in ArticulationBody component inspector causes Unity editor to freeze for hours. Can someone please add watchdog or timeouts to the editor so developers no longer needlessly lose all their work due to simple to handle editor bugs?