I recently started reorganizing my project with assembly definitions. I split up my code into 5 neat folders and added the asmdefs and setup their References.
Next to that I have a bunch of Third Party assets, which are now no longer linked and causing loads of errors. Some of them also have asmdefs, which I can reference individually. But a lot of them don’t.
How do you guys handle referencing those assets that don’t have asmdefs? Do you put them all into one big ‘ThirdPartyAssets’ folder and create one asmdef there? If so, how do you handle their references and any Editor folders inside the ThirdParty folders? Or do you make an asmdef for each ThirdParty asset + one for their Editor folder? If so, how do you handle updates of those assets?
Most videos and articles I see online encourage the use of Assembly Definitions, but this is a hurdle I don’t know how to overcome.
In most cases, most Unity packages/Libraries are split into the following asmdefs :
Libs.asmdef
: references all libraries and includes their asmdefs if there are any
Common.asmdef
: standalone library that contains util classes and extensions that can be needed by both editor and runtime
Runtime.asmdef
: references Common
and Libs
any script/class that needs to be included in a game build or referenced by ANYTHING that can is included or referenced in the build’s actual “game code”
Editor.asmdef
: references Common
and Runtime
since it has know what it needs to create the editor for , make sure to make “Editor” the only platform where this is included in just to be sure
Tests.asmdef
: references Runtime
and Common
(well you can ref Editor
too if you wanna test that), and contains the UnitTest classes that you can run with the TestRunner.
I go with this kind of structure for most of my projects and it works fine