Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Assembly Definitions and native Plugins

Discussion in 'Editor & General Support' started by Nabren, Jun 21, 2019.

  1. Nabren

    Nabren

    Joined:
    Mar 7, 2014
    Posts:
    61
    So starting to move to Assembly Definitions: https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html

    Assembly definitions have defineConstraints where the assembly won't be built unless those constraints are matched, which is PERFECT!

    However, what I would like to do is have native plugins under the assembly folder. The assembly interops with native plugins through marshaling and it would be nice to not include these dependencies in the final build if we don't actually need them.

    At first glace, https://docs.unity3d.com/2018.3/Documentation/ScriptReference/PluginImporter.DefineConstraints.html is exactly what I want, but it apparently only works on managed plugins which is unfortunate.

    The other thing I want to do is use https://docs.unity3d.com/2018.3/Documentation/ScriptReference/PluginImporter.DefineConstraints.html or something like it to disambiguate native plugins with the same name (different versions, etc...) without having to modify files on disk because that just gets annoying with source control.

    Can anyone think of a way to do this that isn't super hacky?