Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question How to manually set AssemblyDefinition's source files?

Discussion in 'Editor & General Support' started by Denis-535, May 8, 2024.

  1. Denis-535

    Denis-535

    Joined:
    Jun 26, 2022
    Posts:
    38
    For example I have two assemblies:
    • Project.UI
    • Project.UI.Internal
    To better control dependency rules I want all my *View.cs sources from Project.UI module to be implicitly moved to Project.UI.Internal module.
    Is it possible to do this somehow?
    Is it possible to completely override script compilation?
     
    Last edited: May 8, 2024
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,941
    An Assembly Definition (asmdef) controls compilation of all scripts in the same folder and all subfolders, unless a subfolder contains another asmdef.

    You cannot have multiple asmdef in the same folder nor can you specify which scripts the asmdef compiles.

    Instead, you would make folders as specified above, where the "UI" folder contains your public asmdef and has a dependency to the internal asmdef which you can store in the "UI/Internal" subfolder.
     
    Spy-Master likes this.
  3. Denis-535

    Denis-535

    Joined:
    Jun 26, 2022
    Posts:
    38
    Probably it would be more convenient if it were possible to manually define include and exclude paths/patterns for each assembly definition.