Search Unity

  1. We would like to hear your feedback about Unity and our products. Click here for more information.
    Dismiss Notice

Use sub folder of repository as a package

Discussion in 'Package Manager' started by QFSW, Jun 10, 2019.

  1. QFSW

    QFSW

    Joined:
    Mar 24, 2015
    Posts:
    2,334
    Is there any way to make a sub folder of a repository the only files included via the package? Either by editing or moving the json

    Thanks
     
  2. felipemunoz_unity

    felipemunoz_unity

    Unity Technologies

    Joined:
    Apr 5, 2019
    Posts:
    5
    Hello!
    As far as I am aware, this functionality is not directly supported by Package Manager yet (it will be in the future but i don't have a clear timeline). While you can add packages to your project using a git url, it would expect you to have the package structure directly in the root of that repository.

    One workaround I can think about though... If you have the following repository structure:
    . (Repository Root)
    |-- Package A
    |-- package.json
    |-- Package B
    |-- package.json

    Then what you could do is to have your repository cloned in the disk and reference those packages through file:/ references in your project manifest.json, as in:
    {
    dependencies: {
    "Package A": "file:<absolute or relative path to repository>/Package A"
    }
    }

    The above should allow you to just import Package A from your repository on that project, but you would still need to manually pull for updates.
     
  3. QFSW

    QFSW

    Joined:
    Mar 24, 2015
    Posts:
    2,334
    Hi,

    No problem, not a big deal

    Is it possible to whitelist/backlist files/folders to be included in the package either? This could also work?

    Thanks
     
  4. felipemunoz_unity

    felipemunoz_unity

    Unity Technologies

    Joined:
    Apr 5, 2019
    Posts:
    5
    The only method I know of that could suite your needs is adding a `~` to a folder you want to "ignore".

    So, let's assume you have
    . (Package A)
    |-- FolderWithCode
    |-- FolderWithOtherThings
    |-- FolderToIgnore

    By adding a ~ to FolderToIgnore you will be hiding everything in it from the asset database. So the final structure would be:

    . (Package A)
    |-- FolderWithCode
    |-- FolderWithOtherThings
    |-- FolderToIgnore~