Search Unity

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

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

  1. Zappyy

    Zappyy

    Joined:
    Jun 9, 2018
    Posts:
    40
    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. Zappyy

    Zappyy

    Joined:
    Jun 9, 2018
    Posts:
    40
    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:
    228
    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. Zappyy

    Zappyy

    Joined:
    Jun 9, 2018
    Posts:
    40
    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. Zappyy

    Zappyy

    Joined:
    Jun 9, 2018
    Posts:
    40
    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. Zappyy

    Zappyy

    Joined:
    Jun 9, 2018
    Posts:
    40
    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. Zappyy

    Zappyy

    Joined:
    Jun 9, 2018
    Posts:
    40
    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,700
    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. Zappyy

    Zappyy

    Joined:
    Jun 9, 2018
    Posts:
    40
    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.
     
  16. ZuuLanTik

    ZuuLanTik

    Joined:
    Feb 19, 2021
    Posts:
    1
    So, can it at least make an include pattern? And the calculated directory i can be preserved? Direct full project calculation, some use dll control project plug-in it can not calculate, nearly destroyed my project.
     
  17. Zappyy

    Zappyy

    Joined:
    Jun 9, 2018
    Posts:
    40
    Hi there,

    Assembly Generator can generate assembly definitions for your entire project or for individual directories (and their subdirectories).

    To generate assembly definitions for the entire project, simply follow the documentation. If you prefer to create assembly definitions for individual directories, you can do so by right clicking in the directory and then in the context menu you can generate directory assemblies for the selected directory. It will always try to resolve dependencies and separate them into editor and runtime assemblies.

    I hope this helps! If you have any other questions or concerns, feel free to ask.
     
  18. ksf000

    ksf000

    Joined:
    Mar 15, 2021
    Posts:
    6
    Hello
    I just bought the asset, deselected my scripts folder, start the process and get errors like that:

    1)Assets\FacebookSDK\Examples\Windows\FBWindowsGraphAPIManager.cs(18,36): error CS0122: 'Constants' is inaccessible due to its protection level

    2)Assets\FacebookSDK\Examples\Windows\FBWindowsInitManager.cs(26,66): error CS0117: 'FB' does not contain a definition for 'FacebookImpl'

    3)Assets\Scripts\PlayerPrefsEditor\Editor\PlayerPrefsEditor.cs(155,33): error CS1069: The type name 'RegistryKey' could not be found in the namespace 'Microsoft.Win32'. This type has been forwarded to assembly 'Microsoft.Win32.Registry, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly.

    and many others

    I am new to asmdef, so could you give me a hint how to fix every kind of the errors?
    Thank you
     
    Last edited: Jul 10, 2023
  19. Zappyy

    Zappyy

    Joined:
    Jun 9, 2018
    Posts:
    40
    Hello ksf000,

    It seems like these errors are likely due to some missing dependencies in your project. As you're new to the use of assembly definitions (.asmdef), it can be a bit complex to unravel. But don't worry, we can break it down into more manageable steps.

    Here's a more streamlined approach to address this:

    1. Begin by generating assembly definitions for a single folder at a time instead of the entire project. This approach simplifies the process and aids in accurately pinpointing the origin of any issues. You can accomplish this by right-clicking on a folder, navigating to the Assembly Generator in the context menu, and selecting 'create module.'

    2. If an error arises, it's likely attributable to a missing dependency. In such cases, you'll need to manually add a reference to the assembly that's missing. This can be done using the 'References' option in the Assembly Definition settings. In some cases it might be a missing .dll file, then you would need to override the references.
    I recommend checking out Unity's official documentation on Assembly Definitions (.asmdef) to gain a deeper understanding about assembly definitions. Let me know if you need any more help.
     
    ksf000 likes this.
  20. illia_rybas

    illia_rybas

    Joined:
    Feb 2, 2018
    Posts:
    5
    Hello
    Looks like it is not available on Assets Store for new purchases anymore. Is it a temporary issue? Any plans to maintain the asset?
     
  21. Zappyy

    Zappyy

    Joined:
    Jun 9, 2018
    Posts:
    40
    Hello illia_rybas,

    I appreciate your interest in this asset. However, I regret to inform you that this particular asset, along with a few others, have been deprecated.

    The decision was driven by the need to maintain a balance between the time and costs involved in maintaining the asset and the demand for it. As an independent developer, I have to constantly evaluate where to best focus my resources.

    Thank you for your understanding and feel free to reach out if you have any other questions.