Introduction
I’ve bought hundreds of products off the Unity Asset Store in my time.
While my list of shame may not be the longest, among my fellow unity developers, it’s still sitting around 500 assets at the time of writing this post. And I can confidently say I don’t regret almost any of my asset purchases up to this point. It was my love for purchasing assets and imagining what I could make with them that inspired me to make my Cyberspace Crusade program that powers my YouTube channel. However, I do have a bone to pick with a fair few of the assets I use on a regular basis.
And that issue is with assemblies.
But What Are Assemblies ❓
For those that aren’t familiar, assembly definitions are boundaries people can set up in their code space. It represents a collection of similar scripts that should be packaged together and perform a particular set of behaviors. When your Unity projects are built, all code placed inside of assemblies is compiled into .dlls and can be accessed by your build game.
It’s generally standard practice for asset makers to put their code inside of an assembly definition reference. That way, the asset’s code is nicely segregated from the developer’s game code and doesn’t extend the time it takes to reload assemblies when an unrelated code recompilation happens. However, there’s a critical mistake I see too many asset makers do to this day with their assemblies: they lack a dedicated EditorAssembly for their assets.
The Silent Build Killer 🔪
The results of this are unnoticeable at first, but the consequences will rear their ugly head the moment a developer tries to create a build for their game. Any editor code not put into an editor-only assembly will throw build errors, as they try to access code only present in a Unity Editor environment. Depending on how many assets were added to the project and how long it had been since the last build, it can become quite a headache to sort out just to get your game back to a build-ready state.
I experienced this firsthand as I recreated a new build for my Cyberspace Crusade project to implement new features and bug fixes. After about an hour of annoyed assembly creation, I got the project back to a build ready. But I’ve had prior build issues due to 3rd party assets assemblies, so the fixing process was routine for me. But for more junior devs who don’t work with assemblies in their own code or those working under time constraints like a game jam, suddenly failing game builds can be a far more catastrophic problem.
But What Can We Do? 🤷♂️
What can be done about this? Being aware of this issue before downloading assets can help, but the true solution lies with asset makers. If you produce on the asset store, please wrap your editor code in an editor-only assembly. Taking that extra step can save developers like me potential headaches down the road, and encourage the usage of your tools in more production-focused projects. Part of the reason this issue likely gets past so many asset makers is how few developers likely produce game builds from their projects. And those who do likely silently add their own assemblies and never mention the asset tweaking they had to do. But just a little bit of conscious design from asset makers, such as building out test projects with their products before release, can go a long way toward improving the quality of life for both new and experienced developers.
Thanks for reading!