Search Unity

Feedback Optional per platform package list

Discussion in 'Package Manager' started by MrMatthias, Nov 28, 2019.

  1. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    168
    It would be great to be able to specify packages per platform (or per configuration, if you ever implement them like you did in a blog post some years ago, what happened to that?)
    For example right now i can't use the latest ARKit features while also trying to support MagicLeap
     
    Last edited: Nov 28, 2019
  2. cassandraL

    cassandraL

    Unity Technologies

    Joined:
    Dec 7, 2017
    Posts:
    108
    Hello @MrMatthias,

    When developing packages, you need to create assemblies.
    Those assemblies specify that the files in the same folder as that file will be included in a generated dll.
    In that assembly file, you can specify which platform you want that dll to work on.
    When building your game, Unity will only bundle the dlls that are meant to work for a specified platform.

    Therefore, you could either publish a package containing assemblies that will work on all platforms or on a subset of platforms. It is up to you!

    To have more details on Assemblies, you can read here: https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html
     
  3. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    168
    Thanks for your answer but that doesn't solve the problem. I'm not the author of the package and the second requirement is that i need different versions of the same package depending on the platform.
    I created an editor script now that backs up the current packages manifest as manifest@{OldBuildTarget}.json and replaces the manifest with manifest@{NewBuildTarget}.json when switching platforms. It solves the issue but has to be communicated to all the team members to avoid confusion. Is there a way to extend the package manager ui?
    edit: IPackageManagerExtension seems to do the job
     
    Last edited: Nov 29, 2019
  4. cassandraL

    cassandraL

    Unity Technologies

    Joined:
    Dec 7, 2017
    Posts:
    108
    Hello @MrMatthias,
    I would like to better understand your issue then.
    If you are creating a project for both ARKit and MagicLeap, then don't you include both packages in your project?
    Are those 2 packages conflicting?

    Technically, only the required packages should go in the final build. Therefore, the ARKit dlls would be included in the build for ARKit-enabled devices and the MagicLeap package would only be included in the build for the MagicLeap.

    So, what issue are you getting?
     
  5. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    168
    Hi @cassandraL
    Both rely on ARFoundation/ARSubsystems, but the latest version that is needed for people occlusion on iOS has conflicts with the magic leap package.
    But it's also a problem for cross platform packages that should only be included on specific platforms, for example Vuforia which is obsolete on iOS due to ARKit (or in general obsolete due to its pricing, but that's another matter).