Search Unity

Conditional package dependency

Discussion in 'Package Manager' started by Araj, Aug 6, 2020.

  1. Araj

    Araj

    Joined:
    Jan 3, 2013
    Posts:
    27
    Hi!

    I'm in the situation where I'd like to add a package as a dependency of another package only if the first package is found in the project.

    Example:
    I have a package named Apples, that doesn't have any dependencies, but has some awesome functionalities available.
    I have another package, Oranges, that would benefit from the functionalities of the Apples package, but it should not be enforced to have it as a dependency.
    Can I somehow detect that I have both packages and add the Apples package inside Oranges?.

    I managed to have some conditional #defines if the package is found (using the Version defines from the asmdef file), but I would like to have access to the API found in the other package.

    Thank you!
     
    JesseSTG likes this.
  2. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    454
unityunity