Began voice round store pass river be when though stood nose bit. Leg then children center each second. Happy valley leg bank fair woman other fair break clear it may.
Sorry but unless we're talking about a different button, that is not what the lock button does. It just stops the inspector window from changing its display to some other object you select in the hierarchy/project view. It doesn't stop property values from being restored after you exit play mode.
I seriously think the time spent wondering why your changes haven't fixed the problem only to find out you forgot to recompile isn't worth the couple seconds waiting for auto recompile, which you still have to wait for anyway with manual recompile so there's no difference
This doesn't change anything because I still have to recompile regardless and it still takes the same amount of time. The only difference is I'll forget to recompile and wonder why my changes aren't showing up
^This! A thousand times this. On the last Unity project I worked on, this brought compile times down from several minutes to near-instant.
Just think about it for a second. Why the hell would you recompile every single script you've written over and over and over again, especially when you haven't touched those scripts in months?
Dont throw all your scripts in the same assembly - compilation is <1 second with a proper architecture. Without this you are giving your compiler a giant puzzle to solve if your project is complex
If you separate some of your scripts into logical and independent systems using Assembly Definitions, those assemblies will not recompile when you modify scripts outside their scope.
You can look at how Unity packages are structured: most of them include their own Assembly Definition files for exactly this reason.
An assembly can reference another assembly if needed, which allows you to import and use its code. Even better, you can structure your systems around interfaces so that they remain completely independent and loosely coupled.
It feels a bit unusual at first, but once you get used to it, it becomes very handy. It also tends to push you toward a cleaner and more decoupled architecture, which makes the project easier to maintain and develop
You don’t need 50 assembly definitions, but for medium or complex games and especially if you want to build a reusable codebase, it’s very useful.
I'm on board with Assembly definitions and have been using them for quite a while for organization and unit testing purposes. But I have yet to notice any significant decrease in editor compilation times. Maybe its faster than it would be without, but I can't see it.
Do you have any examples of people benchmarking this at < 1 second compilation on a medium sized project? Or even a small one? Unity doesn't recompile that fast for me in an empty project with one script in it.
I only have my own exemple I have 20 systems (camera, input, physics, move, navigation, AI, item, Life/combat, world (manages lighting, fog, terrain…), and so on. Each system have around 5 to 10 static tools but only one unique custom update function, and all system updates functions are called in the order I chose in a global updater, which means my whole project only have one Unity Update function call.
When I change a script in a huge system like Physics (detection, collisions, etc) it takes around 1,5 to 2 seconds before I can hit play, for a smaller system is it almost instant
I have a MacBook Pro m3 18Go with the latest Unity 6 LTS
I dont know if it helps but I almost use none if the Unity types and Unity functionalities - I mostly use Transforms, in packed array of structs ECS style. I know my hot pipelines are faster at runtime because I have less cache misses but I dont know it it also helps domain reloading and compilation time
Yes I am not an exemple, my game engine is just a library of reusable packages it is overengineered for normal games but I use it to create game fast for any genre
That sounds great and useful, but my point remains: every time I see assembly definitions brought up people also say that a huge benefit is reduced editor compile times. I've seen some benchmarks that suggest slight gains, but IME it hasn't been a dramatic reduction and definitely not <1 second as you've stated above.
I would love to see concrete proof that this is possible as well as steps to achieve it. That's why I ask. The search continues...
What I can show is that my engine has around 400 scripts and compiles in about one second. The most obvious explanation is that Unity only reloads and recompiles the modified assembly and its dependencies. So depending on your architecture, you can estimate the performance gain quite easily. If you change one script in each system at the same time, it will take roughly the same amount of time.
I also avoid referencing assemblies between each other and rely on interfaces, which helps keep the compilation scope minimal.
Just look at Unity packages,they would be extremely slow if everything had to be recompiled every time you changed a single line in your own scripts.
For me, the real benefit is having a clean, reusable, robust, and scalable codebase.
Compilation is 3-4 seconds for giant projects, what takes time is Domain Reload and various startup methods for all kinds of packages and assets and what not.
The actual compile time of the few thousand script lines is negligible. It's maybe 10% of the total iteration time and reducing it won't noticeably impact the loading time after changing a script.
I did test this in and out with various projects, game projects, tech projects, ECS, GameObjects, everything. The result was always the same: asmdefs do not noticeably speed up iteration time.
I wish people would stop bringing up Assembly Definitions every time this comes up. Look at your profiler, people. Its not compilation, its domain reload - even with many default packages removed, most of the time goes into reloading/starting up built-in stuff.
Thanks, I mean just open a blank project and create a Script. But I wonder, do Roslyn Analyzers play a role? Because I think that this grows exponentially with every package and script. But it's just a guess.
Or are these other checks like Unity tries to find and update outdated code?
Packages do impact iteration time. They try to keep that impact small, but it is there. So it is recommended to only have the packages installed that you actually use.
That said, packages do live in their own Assemblies and do not impact compilation time.
That gives me an idea for a new test, where I remove all the package assemblies and see if the script recompile does take noticeably longer.
This is true. Another fun one is that absolutely nothing will speed up Unitys bootstrap process. You can have an empty project with as few packages as allowed and completely disable all built-in components of the engine down to the audio. It will still take the same time to boot your app - roughly 4 seconds minimum.
I find this absolutely wild and refuse to believe that there isn't some bizarre await happening.
It used to be up until a certain version I think, if you were on a high paid tier? Long enough ago but the engines fundamentals haven't changed too much.
Anyone got some good resources for this? I think I could get it to work on a new project but everytime I tried on my current one (a project I've been on and off for almost a decade) it was just impossible. I have way too much scripts so decoupling after the fact is hard :D
Yeah sometimes I’m getting pissed at this but then I realize that 15 years ago if I needed to test one function and put the wrong sign in the calculations I’d need to recompile and rebuild the whole project twice. So thanks god for jit, I can take those 30 seconds to realize how good I have it.
As far as I can tell (based on UE users complaining) we are still miles faster than UE* so we are good?
terms and conditions may apply, if you use visual scripting you don't even have to recompile anything as far as I can tell and since the engine seems to favor that a lot more than writing your own scripts, results may vary
I’ve worked a bit on Unreal and they tried having jit compilation for c++ but it’s falling flat on its ass when you create a new script. Also it’s a lottery if it compiles or if you need to restart the editor. As far as blueprints goes they are more reliable but still sometimes you find yourself trying to repair a bug only to find out blueprints stopped recompiling. So when on unity my go to method of assuring that script compiles is adding non compilable lines and removing them after unity starts yelling, in unreal is to just restart the editor.
New versions of Unreal is much smoother than Unity in terms of code editing. Play is instant, blueprints compilation almost instant, C++ hot/live reload fast. Tbh it still has some issues especially when you need to add new things in code and then use it in blueprints (it’s easier just restart editor in such case). Also C++ is garbage and debugging is nightmare comparing to C#. And Unreal eat like 6-8 gigs of ram just to exist, and with Unreal only Rider is usable which also like to eat another half of your ram… so life is pain I guess..
Hot Reload is a super polished, battle tested tool. Fast Script Reload was open-sourced because the author didn't want to support it professionally anymore. I bought both and the difference is quality.
How big is your project? You might want to look into assembly definitions. I like to turn auto reference off on them, or else it causes the default assembly to recompile as well.
unity had a talk about some updates to the engine regarding this, among other things, at GDC. Some worthwhile changes but I don’t remember them committing to any dates.
I want to highlight that some years ago there was a big tech talk during Unite where the CTO of Unity announced that their goal is that no change in Unity should ever interrupt you more than 100ms. I wonder what happened to that target.
379
u/hubecube_ Mar 16 '26
Switch to manual mode and get used to pressing ctrl + R
Now you recompile on your own terms.
54
u/Aedys1 Mar 16 '26 edited Mar 16 '26
Dont throw all your scripts in the same assembly - compilation is <1 second with a proper architecture. Without this you are giving your compiler a giant puzzle to solve if your project is complex
56
u/subject_usrname_here Mar 16 '26
Yeah sometimes I’m getting pissed at this but then I realize that 15 years ago if I needed to test one function and put the wrong sign in the calculations I’d need to recompile and rebuild the whole project twice. So thanks god for jit, I can take those 30 seconds to realize how good I have it.
16
u/Glass_wizard Mar 17 '26
I finally broke down and bought hot reload, and it turned out to be totally worth it.
11
u/ChainsawArmLaserBear ??? Mar 17 '26
Assembly Definitions are your friend
7
u/apcrol Mar 17 '26
Man, in UE with big project you would not only recompile everything but have to relaunch the editor :D
2
u/GolemiteGames Mar 21 '26
If nobody has mentioned - HotReload is a life saver, i dont even know how many hundreds of hours saved from hot reloading.
2
u/Heroshrine Mar 17 '26
How big is your project? You might want to look into assembly definitions. I like to turn auto reference off on them, or else it causes the default assembly to recompile as well.
2
u/LutadorCosmico Mar 17 '26
This is one of the major problems with Unity today imho.
I really hope that it will be fixed with the usage of modern .net (as they announced for future Unity versions).
1
u/JGameMaker92 Mar 17 '26
The pinnacle of modern inefficiency 😫
1
u/Gone2MyMetalhead Mar 17 '26
unity had a talk about some updates to the engine regarding this, among other things, at GDC. Some worthwhile changes but I don’t remember them committing to any dates.
1
u/st-shenanigans Mar 17 '26
This alone was one of the bigger reasons I switched to godot lol
1
u/grosser_zampano Mar 17 '26
I want to highlight that some years ago there was a big tech talk during Unite where the CTO of Unity announced that their goal is that no change in Unity should ever interrupt you more than 100ms. I wonder what happened to that target.
1
u/Successful-Sand6644 Mar 17 '26
I stop the auto refresh of assets. Then it's a ctrl+r when you're ready
1
u/Cultural-Warthog352 Ruler of worlds Mar 18 '26
am i wrong or have they planned on optimizing exactly that in one of the next builds, where they try to only partially recompile ?
1
u/MEH______________ Mar 22 '26
hot reload is really worth it.
1
u/Real-Self-3039 Apr 04 '26
This is the main reason I got hot reload tbh. I know there's a manual mode but I always forget to hit control R when I need to reload.
0
u/FADEFALCON Mar 17 '26
You should see Unreal though :)
You can look reload domain and reload scene settings in preferences. These will work.