r/unity_tutorials • • Apr 04 '23

Video Assembly Definitions, Explained - Learn what these are and how they can help you iterate faster in your project when making code changes!

66 Upvotes

5 comments sorted by

3

u/LlamAcademyOfficial Apr 04 '23

Full Tutorial on YouTube

Hey all 👋! Happy #TutorialTuesday!

This week you can learn about Assembly Definitions, which are a Unity Construct to create C# Projects within your game's "Solution". This allows Unity to determine which scripts needs to be compiled after making a change, instead of naively recompiling the entire project. Compiling fewer scripts lets you get back into the editor faster after making code changes!

👨‍💻 You can see the specific examples implemented on the Gun Scriptable Object Series GitHub

2

u/No-Menu-791 Apr 05 '23

In the video was written, don't be too granular. Is there any issue with it or is it just mentioned for the sake to reduce maintenance overhead?

2

u/LlamAcademyOfficial Apr 05 '23

You got it! If you get so granular with namespaces and asmdefs where there’s only like 2 classes in each, it’s probably not quite the right approach

1

u/No-Menu-791 Apr 05 '23

What about stuff not in assemblies that I want to reference in an asmdef.

Structure is Scripts - Interfaces - InterfaceScript.

I want to use that in Scripts - Foo - FooScript where FooScript is in the Foo asmdf. Can this be referenced or does everything thats used in a script thats inside a asmdf need to be in an other asmdf as well?

2

u/LlamAcademyOfficial Apr 05 '23

If they’re not in an assembly, they’re globally scoped so you can access them without a specific dependency