Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Reload script assemblies take a long time even if it is a new project

Discussion in 'Editor & General Support' started by Personuo, Oct 7, 2022.

  1. Personuo

    Personuo

    Joined:
    Mar 19, 2014
    Posts:
    129
    I found that reload script assemblies took a lot of time after the project modified the code. To verify the problem, I created a new empty project and created a new script to test, It's still take a long time (2s~5s).

    test in 2021.3.10

    I remember clearly that in the previous version, when you had very few scripts, you could compile the code very quickly and not so slowly

    I dont know why I cant link this video .
    https://www.youtube.com/shorts/fwGyzxRVaIo
     
  2. Personuo

    Personuo

    Joined:
    Mar 19, 2014
    Posts:
    129
    Does anyone care about this?
     
  3. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,606
    They do, but this topic has been discussed to death and everyone has long since been aware that 2021 and 2022 are reasonably slower than 2020 and 2019.

    There's a 9 page thread stickied in the scripting forum about it: https://forum.unity.com/threads/improving-iteration-time-on-c-script-changes.1184446/

    In short, remove all packages you don't need, use assemblies, and don't load your project to the gills with plugins if you can help it.
     
    Homicide likes this.
  4. Homicide

    Homicide

    Joined:
    Oct 11, 2012
    Posts:
    657
    And one last thing mentioned in that giant sticky thread, that may or may not help you, but definitely sped up my end, is that you can disable directory monitoring and asset refresh. Again, this may or may not help your specific case, but it sure as hell sped things up big time on my end.

    gl
     
  5. davidnibi

    davidnibi

    Joined:
    Dec 19, 2012
    Posts:
    426
    Asset refresh on my end (amongst other things). This isn't a long wait, it's restart Unity and lose work because I'm not saving every 30 seconds - how do you disable this?

    upload_2022-11-13_11-19-12.png
     
  6. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    658
    @davidnibi Not sure, but there seems to be some relationship between this blocking behavior and debugging with a breakpoint switching back to Unity. I see it most often when I have a debugger attached and I am flipping between Unity and Visual Studio. Is this at all similar to your scenario?
     
  7. Personuo

    Personuo

    Joined:
    Mar 19, 2014
    Posts:
    129
    that point is that is a empty new project.
     
  8. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,606
    Doesn't disqualify my points/advice.
     
  9. davidnibi

    davidnibi

    Joined:
    Dec 19, 2012
    Posts:
    426
    Yeah, it's when both are open. It could be, but I don't think Unity's developers know anyway.
    I'm really concerned as it is now hanging my PC at times, and I'm having to hard reset - I've lost work, and some of my save files have been corrupted, including my project/scene files. It's become impossible to continue.

    This is my current project load screen, and (desperately) trying to backup my project as a package ... doesn't look hopeful does it?
    upload_2022-11-15_0-11-16.png

    upload_2022-11-15_0-12-20.png

    upload_2022-11-15_0-20-2.png
     
    Last edited: Nov 15, 2022
  10. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    658
    @davidnibi It never resolves for me, and I have to kill the Unity process in task manager. Happens about five to ten times a day on Unity 2022.1.20f1.