Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Assembly Generator: The Ultimate Tool for Optimizing the Performance of Your Unity Editor

Discussion in 'Assets and Asset Store' started by dajnoo, Jan 2, 2023.

  1. dajnoo

    dajnoo

    Joined:
    Jun 9, 2018
    Posts:
    32
    Assembly Generator is the ultimate tool for optimizing the performance of your Unity editor! With just a few clicks, you can quickly and easily generate assembly definition files that will help you organize and compartmentalize your code and assets into smaller, more focused assemblies.

    But what exactly is an assembly definition file, and why is it so important for the performance of your Unity project? Simply put, an assembly definition file is a special file that defines a group of scripts and assets that should be compiled together into a single assembly. By organizing your code and assets into smaller assemblies, you can improve the overall performance of your Unity project by reducing the time it takes to load and compile your code and assets. This is especially important for large, complex projects that have a lot of code and assets to manage.

    However, it's worth noting that not all asset developers use assembly definitions, which can slow down compilation time. Additionally, Unity has to recompile everything every time you change something in an assembly definition, which can make the process of creating them manually a slow one.

    Assembly Generator is the perfect solution for creating assembly definition files. It's lightweight, easy to use, and will save you a ton of time and hassle. With Assembly Generator, you don't have to spend hours creating assembly definition files manually - just open the editor window by going to Tools-> Assembly Generator, and enter the absolute path of the root directory of your Unity project in the Root Directory field. If you want to exclude a specific folder from the assembly definition process, you can enter the absolute path of that folder in the Excluded Folder field. Then, just click the "Create Assemblies" button and Assembly Generator will do the rest, generating assembly definition files for all of the directories within the root directory, except for the excluded folder if specified.

    Don't waste any more time struggling to manage your code and assets manually! Try Assembly Generator today and see the difference it can make for the performance of your Unity project. Save time, streamline your workflow, and improve the performance of your Unity project - all with just a few clicks of a button.

    Asset Store Link
    Online Documentation

     
    Last edited: Jan 14, 2023
  2. HikmetDuran

    HikmetDuran

    Joined:
    May 7, 2017
    Posts:
    11
    Great asset!
    Question before buying: Does it add needed references between asmdefs while creating them?
     
  3. dajnoo

    dajnoo

    Joined:
    Jun 9, 2018
    Posts:
    32
    Thank you for your question! The Assembly Generator does not currently have the ability to specify assembly references between assembly definition files. When an assembly definition file is created, it includes an empty "references" array, which means that it does not depend on any other assemblies. However, you can manually add assembly references to the the assembly definition file if you would like to create dependencies between assemblies or add dll files (override references). It's up to the developer to determine the desired structure for their assemblies and add the necessary references.
     
  4. Ghosthowl

    Ghosthowl

    Joined:
    Feb 2, 2014
    Posts:
    215
    So basically the asset only generates blank asmdef files? Because a large reason many developers forgo them is due to complicated nature of having to solve cyclic dependencies and adding the proper references.

    At first glance I thought this might have been something that handled moving code chunks and all that jazz, but I thought about it again and said no way it could do all that.
     
  5. Hamurapa

    Hamurapa

    Joined:
    Dec 20, 2016
    Posts:
    2
    The asset doesn't work "From the box". After installation and "Generate", I have to change all the namespaces in my scripts. But my project still didn't work. It lost relations to Unity namespaces and libs.
    Conclusion: I had to remove your asset :(
     
  6. dajnoo

    dajnoo

    Joined:
    Jun 9, 2018
    Posts:
    32
    Thank you for bringing this issue to my attention. I apologize for the inconvenience that this has caused you. Unfortunately, the current version of the assembly definition generator asset does not support adding references to other Unity assembly definitions or DLLs yet. However, I am actively working on implementing this feature in future updates to the asset. In the meantime, as a workaround, I recommend manually adding references to any necessary Unity assembly definitions or DLLs in the generated assembly definition files. This way you could still use the asset for generating assembly definitions for specific folders of your project, rather than all folders at once. This way, you'll be able to continue to use the asset for generating assembly definitions for specific parts of your project, while keeping the overall project functional. Please let me know if there's anything else I can do to help. I appreciate your feedback.
     
  7. Hamurapa

    Hamurapa

    Joined:
    Dec 20, 2016
    Posts:
    2
    Thank you, I'll wait for the feature implementation and will check your asset again.
     
  8. DoronElisha

    DoronElisha

    Joined:
    Mar 12, 2016
    Posts:
    3
    Hi, maybe you could help me, I get this error when pressing Generate
    DirectoryNotFoundException: Could not find a part of the path "/Users/bem/CentromGames/Bloxe/Assets/Zappy/Assembly Generator/Generated Assemblies/Runtime/AssemblyGenerator.Generated.Runtime.asmdef/..\/AssemblyGenerator.genasm".


    The error sends me here
    AssemblyGeneratorWindow.OnCreateClicked (UnityEngine.UIElements.VisualElement element) (at Assets/Zappy/Assembly Generator/Scripts/AssemblyGeneratorWindow.cs:92)

    Any chance you might help ?
     
  9. dajnoo

    dajnoo

    Joined:
    Jun 9, 2018
    Posts:
    32
    Hello, it looks like the directory path might not be valid. Have you made any changes to the folder structure, such as moving the Assembly Generator folder from its original location? Did you enter anything in the "Exclude Directory" field? Are you on Windows?

    This information could help identify the root cause of the issue.
     
  10. dajnoo

    dajnoo

    Joined:
    Jun 9, 2018
    Posts:
    32
    I've released a version should be able to handle referencing other assembly definitions. Have you had the chance to try it out yet? If so, I would appreciate your feedback on whether it resolved the issue for you.

    If you have multiple complex dependencies, it may be more efficient to generate them separately. To do this, right-click within any script folder and select "Assembly Generator" then "Create Module." This will generate assembly files only for the selected folder, making it easier to identify and resolve potential issues.
     
    Last edited: Feb 5, 2023
  11. DoronElisha

    DoronElisha

    Joined:
    Mar 12, 2016
    Posts:
    3

    I did not change the file destination folder or added any excludes, Im using mac, I added the package and clicked Generate Assemblies
     
  12. dajnoo

    dajnoo

    Joined:
    Jun 9, 2018
    Posts:
    32
    It seems that the problem you are encountering may be caused by running the code on a Mac. I've made some changes to the code that should resolve the issue.

    The updated package will be reviewed by the Unity asset team and is expected to be available in 2-3 days. If you require the package sooner, please send me your invoice number and I will send the updated package directly to you. You can find my contact details here.

    Note that the change is expected to resolve the issue, but I cannot confirm this as I do not have access to a Mac to test it on right now. I apologize for any inconvenience this may have caused and I will do my best to resolve the issue as soon as possible.
     
  13. DoronElisha

    DoronElisha

    Joined:
    Mar 12, 2016
    Posts:
    3
    Thank you! Awesome plugin!

    EDIT:
    Thanks It works perfect now! Great plugin! I can easily recommend it.
     
    Last edited: Feb 5, 2023
  14. DragonCoder

    DragonCoder

    Joined:
    Jul 3, 2015
    Posts:
    1,097
    Hello.
    Am unfortunately quite stomped on how to use this asset correctly. Pressing the "generate Project Assemblies" buttons results in over 600 errors.
    Using the context menu in a singular directory to generate only for that directory also results in errors.

    It's always "The type or namespace name 'type/namespace' could not be found (are you missing a using directive or an assembly reference?)" for classes that are defined in other directories. It feels like the module cannot see anything that's outside of itself anymore.
    Isn't automating this kind of dependencies exactly what the asset should do for us? Is there a first step required like to create a global module of some sort?

    Huge thanks in advance!

    P.s. System is windows and it's Unity 2022.1
     
  15. dajnoo

    dajnoo

    Joined:
    Jun 9, 2018
    Posts:
    32
    Hello there,

    I understand that you are experiencing some issues with one of my Unity assets. I'm here to help you out with that!

    Your errors might be caused by editor scripts that depend on runtime scripts. In previous versions of Assembly Generator, the runtime assembly was automatically added to the editor assembly. In most cases that's what you want, but some users didn't like this so it was removed in the latest update. I might have to revert it or try to find another solution for it though.

    In the meantime, you could try adding the runtime assembly manually to see if that resolves the problem. Here are the steps (if you generated project assembly definitions):

    1. Click on the editor assembly definition in Assets/Generated Assemblies\Editor\Editor.asmdef.
    2. In the Inspector, you should see a section called "Assembly Definition References", and a small + icon where you can add new assembly definition references.
    3. Click the plus icon and add a reference to the assembly called "Runtime".

    Please let me know if this resolves your problems or if you have any more questions.