Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

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:
    281
    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.
     
  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:
    281
    It seems to be larger projects that are affected
     
  4. goodnewsjimdotcom

    goodnewsjimdotcom

    Joined:
    May 24, 2017
    Posts:
    290
    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:
    455
    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.
     
    aloften likes this.
  8. aloften

    aloften

    Joined:
    Aug 25, 2017
    Posts:
    17
    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.
     
  9. aloften

    aloften

    Joined:
    Aug 25, 2017
    Posts:
    17
    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
    Homicide likes this.
  10. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    11,606
    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,015
    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:
    281
    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.
     
  13. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    11,606
    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:
    281
    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:
    146
    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
    richatd_q likes 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. dorusoftware

    dorusoftware

    Joined:
    Jul 5, 2012
    Posts:
    841
  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:
    114


    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. dorusoftware

    dorusoftware

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

    DJ_Design

    Joined:
    Mar 14, 2013
    Posts:
    114
    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. dorusoftware

    dorusoftware

    Joined:
    Jul 5, 2012
    Posts:
    841
    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:
    114


    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.
     
  28. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    281
    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:
    797
    I like how UT just ignores this problem hoping it will go away by itself.
     
    Roman_34 likes this.
  30. dorusoftware

    dorusoftware

    Joined:
    Jul 5, 2012
    Posts:
    841
    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!
     
    DavidZobrist likes this.
unityunity