Search Unity

Strategies for Custom Package Dependency Management?

Discussion in 'Package Manager' started by RRVR1, Jul 29, 2019.

  1. RRVR1

    RRVR1

    Joined:
    May 15, 2018
    Posts:
    2
    We currently have a set of custom packages which are setup using scoped registries and they are working as expected. A problem we are running into though is that certain packages share a dependency on an asset we'll call A. So in essence package B and C both need asset A in them. What's the proper way to handle this? My instinct says we can create package D to handle all shared dependencies for packages B, C, etc but I'm not quite sure how we can do this with our current setup. Can anyone provide some clarity on this point/some pointers on how to implement the proper way to do this?
     
  2. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    556
    Hi @RRVR1,

    Your instinct is right. You can simply create a package D containing asset A, and add a dependency to package D in your packages B and C. Take a look at the documentation on package manifests. Note that this will work well if the shared asset is not intended to be modified in the project - otherwise, you should probably include some code in the package D to create a new asset in your project under the Assets directory, either automatically (e.g. using InitializeOnLoad-triggered code) or manually (e.g. using MenuItem-triggered code).