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

Reload Script Assemblies upon every Play/Stop in empty project

Discussion in 'Scripting' started by paulrumyancev, Jan 6, 2022.

  1. paulrumyancev

    paulrumyancev

    Joined:
    May 4, 2021
    Posts:
    4
    I want to raise the issue of "Reload Script Assemblies" popup again. It turns to really critical one.
    In my case, almost clean (1 script) project popups up "Reload Script Assemblies" popup every time I enter Play mode. (attaching GIF)


    Though there is a related thread devoted to discussion of increased compilation times "when changing one C# script"
    https://forum.unity.com/threads/improving-iteration-time-on-c-script-changes.1184446/
    The issue seems to be more critical
     

    Attached Files:

  2. Trindenberg

    Trindenberg

    Joined:
    Dec 3, 2017
    Posts:
    395
    If you go into Project Settings > Editor > Enter Play Mode Settings you can turn off Domain Reload. Play becomes instant.
     
    BlaqueC, Tranda, boucherlfg and 8 others like this.
  3. paulrumyancev

    paulrumyancev

    Joined:
    May 4, 2021
    Posts:
    4
    It's turned off
     

    Attached Files:

    originalsurfmex likes this.
  4. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    No, you have to turn on "enter play mode options" to have the option to turn it off fire. So turn on the first toggle.

    That's... I hadn't thought about it before, but yeah the menu design there is pretty awful.
     
  5. paulrumyancev

    paulrumyancev

    Joined:
    May 4, 2021
    Posts:
    4
    Oh yeah! It helped! Thanks! And yes, the design is terrible! How can one guess it?
     
    ahammed15-611 and JasonDaze like this.
  6. lukifah

    lukifah

    Joined:
    Jul 13, 2022
    Posts:
    1
    i need to change it on every new project, why is that.
     
  7. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,612
    Because Project Settings, as the name implies, are per-project.
     
    Bunny83 and kreti like this.
  8. RobertOne

    RobertOne

    Joined:
    Feb 5, 2014
    Posts:
    258
    I wish people would stop mentioning the Domain Reload skip function. It introduces so many bugs and breaking plugins that hard to indentify and out of the sudden you remember "wait, ive set this toggle someone in the forum told me about"

    I ve spent hours figuring out why my physics went crazy but only on the second startup until i remembered i set those toggles to true

    really, read the docs first!:
    https://docs.unity3d.com/Manual/DomainReloading.html
     
    xucian, Nikita500, Waz and 6 others like this.
  9. originalsurfmex

    originalsurfmex

    Joined:
    Jun 11, 2015
    Posts:
    1
    I haven't found away to stop the rebuilding other than Domain Reload skip. Thanks for the warnings though, didn't know skipping Domain Reload caused other issues.

    If I modify scripts as suggested in the manual is that enough? Are there other unintended issues that arise?
     
  10. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    It's not very hard to work with if you understand what it does and why.

    The big problem is if you've either got an old project with some gnarly coding practices that makes it hard to deal with, or if you're importing a lot of code from the asset store and/or online tutorials that doesn't support the feature.
     
    CodeRonnie likes this.
  11. BohTar

    BohTar

    Joined:
    Jun 20, 2014
    Posts:
    10
    So basically we are again stuck with compatibility issues and long editor play wait times even for smaller projects? Thanks unity... again
     
    paskapytty and erdostamasa like this.
  12. Sights

    Sights

    Joined:
    Mar 1, 2019
    Posts:
    1
    I still don't know a proper solution, but I noticed when you have one of your scripts open from the project in a code editor, if you get the 'reloading script assemblies' bar stuck, just save that script without any changes while that happens and playmode starts working. Worked every time so far but yeah, not a solution or anything.
     
  13. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,533
    Issues do occur when I open other people's projects, be it demos or tutorials or otherwise.

    I've not run into issues with Domain Reload Disabled in projects that I create, not even with assets/packages so far. This may be because I only use quality assets/packages, it's rare for me to use an asset that hasn't been updated in the past 12 months. Even so, it's only a matter of checking for any "static" field and if there is such an instance, adding a
    (Runtime)InitializeOnLoadMethod that sets the static fields to null or new(). I think I've had to do this maybe once or twice this year.

    Given that this option saves me a lot of time when iterating, I always make sure it works. It also forces me to re-think whether I really need a static here.
     
    CodeRonnie likes this.
  14. Shapely

    Shapely

    Joined:
    Jun 6, 2020
    Posts:
    7
    Awesome! Instant play mode. Thanks buddy.
     
  15. lion422

    lion422

    Joined:
    Aug 4, 2020
    Posts:
    10
    I'm confused with this. Apart from this forum thread, Google results show only people complaining about having this Reload Script Assemblies loading "when they change a script" (which sounds fine to me).
    Nobody ever mentions having it every single time they hit Play.
    So is this a bug, a weird setting I activated somehow?
     
  16. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,612
    Yes this is normal, and yes you can turn it off. The post above yours is quoting how to turn it off.
     
  17. lion422

    lion422

    Joined:
    Aug 4, 2020
    Posts:
    10
    Yes but it also breaks everything relying on static variables being reset between sessions.
    I'm 100% certain that this reloading was not there 1 year or 2 ago.
    Plus, what's the logic of reloading script assemblies when no script has been modified anyway??
     
  18. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,612
    Then don't over rely on static values or make sure your static classes reset when play mode is exited. It's pretty easy to do.

    It's always been there. Just newer version of Unity show an actual popup rather than the editor just hanging.

    It's not just reloading script assemblies, it's a domain reload, which involves more than just compiling scripts.
     
    CodeRonnie likes this.
  19. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,952
    Turn it on to turn it off :D
    Thanks for the note!