Reload Assemblies making enterplaymode take long

I’ve seen others saying that clicking the play button takes them only a second or two to get into play mode. For me it takes around 7-9 seconds every time regardless of if I do the switching build target trick (to reload the targeted platform) or click play several times consecutively.

Thus, I tried profiling the editor a few times to try and find where my issues may arise. Then this got logged,

ReloadAssemblies is taking more than 4 seconds by itself. Is it even normal for ReloadAssemblies to trigger every single time I press play? If so, is it avoidable?

I’ve seen this, LockReloadAssemblies which I haven’t tried as it doesn’t seem like something I should use to solve this (though I’ll try it). Has anyone else had this issue or maybe know of something I can try?

Processor: Intel Core i7-4700MQ 2.40Ghz (3.20 Ghz when it’s doing any decent lifting)

Memory: 16GB

Graphics Card: Intel Graphics 4600 and Nvidia GTX 765M (Default)

Or any static classes, also this isn't how you "restart the game" this is how you restart the current scene you're in. Why this solution was upvoted 14 times, i'll never know. lol

4 Answers

4

I’ve got this problem as well, but I don’t know what to do…

Did you ever find how to actually restart the game not just the scene?

profile your editor, it is often caused by “reaload assemblies”'s GC.


see also: https://forum.unity.com/threads/unity-entering-play-mode-slowly-due-to-spending-10-20-seconds-in-reloadassemblies.471683/

Pretty sure there is no way to do it. Best solution might be to just add a scene loaded event to your objects that don't destroy on load and destroy them manually. Like this SceneManager.sceneLoaded += OnSceneLoaded(name of your method) And they should spawn with reinitialized values when the scene they're in loads. Also, you might want to load scene 0, not GetActiveScene().

Same problem here

Switched to Unity 2021 from 2019 and suddenly got this problem as well. Never had this before. What’s going on?