# Custom Package with Git Dependencies

**URL:** https://discussions.unity.com/t/custom-package-with-git-dependencies/732000
**Category:** Package Manager
**Tags:** Package-Manager
**Created:** [February 12, 2019, 4:07pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000 "2019-02-12T16:07:34Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![OloinMilsom](https://avatars.discourse-cdn.com/v4/letter/o/47e85d/32.png) [@OloinMilsom](https://discussions.unity.com/u/OloinMilsom)
#### Post date: [February 12, 2019, 4:07pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/1 "2019-02-12T16:07:34Z")

</div>

Using Unity 2018.3.1f1 I am investigating if it’s possible to create a dependency in a custom package’s package.json to another custom package.

For example, I created two package.json files like these:

**Dependency**

```javascript
{
    "name": "com.test.dependency",
    "displayName": "Test Dependency",
    "version": "0.0.1",
    "unity": "2018.3",
    "description": "bla bla bla",
    "category": "Unity",
    "dependencies": {}
}

```

**Depender**

```javascript
{
    "name": "com.test.depender",
    "displayName": "Test Depender",
    "version": "0.0.1",
    "unity": "2018.3",
    "description": "bla bla bla",
    "category": "Unity",
    "dependencies": {
        "com.test.dependency": "https://github.com/GitUserName/Test.Dependency.git"
    }
}

```

I then created a new unity project and added the **Depender** to the manifest.json:

```javascript
{
    "dependencies": {
        "com.test.depender": "https://github.com/GitUserName/Test.Depender.git",
        ...
    }
}

```

Upon opening this project I get the following error:  
_Package com.test.depender@[https://github.com/GitUserName/Test.Depender.git](https://github.com/GitUserName/Test.Depender.git) has invalid dependencies:_  
_com.test.dependency: Version ‘[https://github.com/GitUserName/Test.Dependency.git](https://github.com/GitUserName/Test.Dependency.git)’ is invalid. Expected a ‘SemVer’ compatible value._

I’m wondering if there’s anything I’ve missed that would get this working. If it is not possible, as the errors would suggest, to have custom dependencies in a package.json file, will this be supported in future?

---

<div class="post-metadata">

### Author: ![anon30979860](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@anon30979860](https://discussions.unity.com/u/anon30979860)
#### Post date: [February 12, 2019, 4:51pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/2 "2019-02-12T16:51:50Z")

</div>

> [@OloinMilsom](#):
>
> Using Unity 2018.3.1f1 I am investigating if it’s possible to create a dependency in a custom package’s package.json to another custom package.
> 
> For example, I created two package.json files like these:
> 
> **Dependency**
> 
> ```javascript
> {
> "name": "com.test.dependency",
> "displayName": "Test Dependency",
> "version": "0.0.1",
> "unity": "2018.3",
> "description": "bla bla bla",
> "category": "Unity",
> "dependencies": {}
> }
> 
> ```
> 
> **Depender**
> 
> ```javascript
> {
> "name": "com.test.depender",
> "displayName": "Test Depender",
> "version": "0.0.1",
> "unity": "2018.3",
> "description": "bla bla bla",
> "category": "Unity",
> "dependencies": {
> "com.test.dependency": "https://github.com/GitUserName/Test.Dependency.git"
> }
> }
> 
> ```
> 
> I then created a new unity project and added the **Depender** to the manifest.json:
> 
> ```javascript
> {
> "dependencies": {
> "com.test.depender": "https://github.com/GitUserName/Test.Depender.git",
> ...
> }
> }
> 
> ```
> 
> Upon opening this project I get the following error:
> 
> I’m wondering if there’s anything I’ve missed that would get this working. If it is not possible, as the errors would suggest, to have custom dependencies in a package.json file, will this be supported in future?

For security and stability reasons, this is currently not supported, by design. I can’t say whether or not this feature will be supported in the future for custom packages, but I expect that no published package hosted by Unity will ever be allowed this since it essentially side-steps any kind of validation/verification of the package.

What you can do, however, is use a scoped registry (a.k.a. private registry) to publish your custom packages on a registry you control. (See [https://discussions.unity.com/t/719331](https://discussions.unity.com/t/719331) for more information on how to set this up.)

Also note that while the packages are embedded in your project or declared as a dependency in your project manifest, they override any package of the same name found as a package dependency during dependency resolution. So, barring the use of a scoped registry, your above setup would work if you explicitly added the Dependency package in your project manifest using a Git URL, and updated your Depender package.json so it did not declare a dependency on the Dependency package or declared it with a version (that would be ignored in favor of the project dependency on Dependency).

---

<div class="post-metadata">

### Author: ![Karnsteiner1](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/karnsteiner1/32/91798_2.png) [@Karnsteiner1](https://discussions.unity.com/u/Karnsteiner1)
#### Post date: [April 17, 2019, 8:57am UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/3 "2019-04-17T08:57:29Z")

</div>

I might be mistaken, but it seems like Oloin is referring more to a package hosted on his own git repository versus one hosted by Unity. I am also looking at this for splitting up an open source project hosted on github into several smaller packages with one core and the others as optional secondaries requiring core.

It seems implied that something like this might work based on what forum threads/documentation I’ve found, but now requires a user to list all dependencies of a package independently in the manifest.json file and won’t account for sub-dependencies (two levels deep dependencies or more).

**Package.json**

```javascript
{
    "name": "com.test.depender",
    "displayName": "Test Depender",
    "version": "0.0.1",
    "unity": "2018.3",
    "description": "bla bla bla",
    "category": "Unity",
    "dependencies": {
        "com.test.dependency": "1.0.0"
    }
}

```

**Manifest.Json**

```javascript
{
    "dependencies": {
        "com.test.dependency": "https://github.com/GitUserName/Test.Dependency.git",
        "com.test.depender": "https://github.com/GitUserName/Test.Depender.git",
        ...
    }
}

```

---

<div class="post-metadata">

### Author: ![k0dep](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/k0dep/32/541052_2.png) [@k0dep](https://discussions.unity.com/u/k0dep)
#### Post date: [May 3, 2019, 5:31pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/4 "2019-05-03T17:31:40Z")

</div>

Hello to all! I partially solved this problem. Here is the link to the package: [github.com/k0dep/Originer](https://github.com/k0dep/Originer)

---

<div class="post-metadata">

### Author: ![Thaina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/thaina/32/93260_2.png) [@Thaina](https://discussions.unity.com/u/Thaina)
#### Post date: [May 6, 2019, 7:17am UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/5 "2019-05-06T07:17:11Z")

</div>

> [@maximeb\_unity](#):
>
> For security and stability reasons, this is currently not supported, by design. I can’t say whether or not this feature will be supported in the future for custom packages, but I expect that no published package hosted by Unity will ever be allowed this since it essentially side-steps any kind of validation/verification of the package.
> 
> What you can do, however, is use a scoped registry (a.k.a. private registry) to publish your custom packages on a registry you control. (See [https://discussions.unity.com/t/719331](https://discussions.unity.com/t/719331) for more information on how to set this up.)
> 
> Also note that while the packages are embedded in your project or declared as a dependency in your project manifest, they override any package of the same name found as a package dependency during dependency resolution. So, barring the use of a scoped registry, your above setup would work if you explicitly added the Dependency package in your project manifest using a Git URL, and updated your Depender package.json so it did not declare a dependency on the Dependency package or declared it with a version (that would be ignored in favor of the project dependency on Dependency).

This is seriously annoyingly nonsense. The usable of package manager is to let us able to share any package with any dependency package and the manager will resolve all dependency automatically. If you don’t let us upload all of our package on your server directly then it limit the usability of the manager. We must uselessly include all of our sub package in our own package or else we cannot share it

If we only develop individually or internally then we don’t really need package manager at all. The point is to share the package as a submodule to anyone and anywhere. Scope registry is totally useless and waste of time on your side. We only need git dependency and custom dependency. I really want to ask who was think about this idea and waste all your time? Have you even think about the use case scenario before add this feature?

We just need a custom dependency. Not a useless workaround like scoped registry unless the scope registry could be resolved from dependency. If we tell people that “you can add our package into package manager” but then “oh but you also need to add this line in this file and these lines in this file and this line in these files” then it become totally pointless to have package manager

---

<div class="post-metadata">

### Author: ![anon30979860](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@anon30979860](https://discussions.unity.com/u/anon30979860)
#### Post date: [May 6, 2019, 2:46pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/6 "2019-05-06T14:46:11Z")

</div>

> [@Thaina](#):
>
> This is seriously annoyingly nonsense. The usable of package manager is to let us able to share any package with any dependency package and the manager will resolve all dependency automatically. If you don’t let us upload all of our package on your server directly then it limit the usability of the manager. We must uselessly include all of our sub package in our own package or else we cannot share it
> 
> If we only develop individually or internally then we don’t really need package manager at all. The point is to share the package as a submodule to anyone and anywhere. Scope registry is totally useless and waste of time on your side. We only need git dependency and custom dependency. I really want to ask who was think about this idea and waste all your time? Have you even think about the use case scenario before add this feature?
> 
> We just need a custom dependency. Not a useless workaround like scoped registry unless the scope registry could be resolved from dependency. If we tell people that “you can add our package into package manager” but then “oh but you also need to add this line in this file and these lines in this file and this line in these files” then it become totally pointless to have package manager

Hi @Thaina ,

I’m sorry to hear that the Package Manager does not exactly fit your requirements.

We are still working on putting the required infrastructure, tooling, and publishing flows to enable external contributions to the Package Manager registry. That is why I mentioned setting up a private registry would be the first step in sharing custom packages.

Setting up your own registry (for instance Verdaccio -  
[https://github.com/verdaccio/verdaccio](https://github.com/verdaccio/verdaccio)) is actually pretty simple. It’s installed using npm, and run using a single command-line. Configuring the Package Manager to use that scoped registry is also not too complicated - an action you need to do once per project so the Package Manager knows where to look in addition to the main registry (see [https://docs.unity3d.com/Manual/upm-scoped.html](https://docs.unity3d.com/Manual/upm-scoped.html)) when it resolves the project’s dependencies.

For example, you could add the following to a project manifest:

```csharp
"scopedRegistries": [
    {
      "name": "My Registy",
      "url": "<http(s)-url-to-your-registry>",
      "scopes": [
        "com.thaina"
      ]
    }
],

```

and all packages whose name begins with `com.thaina.` would be fetched from that registry, which you’re free to administer as you wish.

---

<div class="post-metadata">

### Author: ![Thaina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/thaina/32/93260_2.png) [@Thaina](https://discussions.unity.com/u/Thaina)
#### Post date: [May 6, 2019, 3:15pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/7 "2019-05-06T15:15:02Z")

</div>

@maximeb_unity That’s the point that I would call it pointless

The point is, this feature is **Package Manager**. It was named as “ **Package Manager** ” and you can see that every popular package manager, be it NPM or NuGet, has an ability to resolve all of it dependency as first priority. Because if the package can resolve dependency in one machine but failed to resolved in another machine without tweaking configuration, That package would become useless, and also the manager itself would be a totally useless manager

And to config each and every machine just to use one package is defeating the purpose of using package manager itself. So if any feature want to have be named **Package Manager** it should have a way to resolve dependency of any depth from the package itself without having people go manage each dependency when they just want to include another package

People try to include package in their project for their convenience. But you are making this useless package manager that force people to do inconvenience things it defeat the purpose of using **Package Manager** immediately

_an action I need to do once **per project** _ is not acceptable for the feature named **Package Manager.** It must be _an action I need to do once **per package**._ It must be an action that, when I tell some people to include my package. They only really need to **_just include my package_** and done, the manager will do everything on its own to resolve every bits of dependency into that person’s project, any number of person and any number of project, to have each person need to tweak each project they create just to use my package it a uselessly annoyingly inconvenience loss cost

Because the usability of the feature named **Package Manager** is that, **I** am not the one who use it. There would be many people to use it by installing my package into their project

This is why I want to ask that, have you ever think about the use case scenario of this feature? Have you ever think about the actual use case scenario of feature named **Package Manager**? Who have suggest you to try doing that useless scope registry feature before custom dependency? You trying to present scope registry is telling me that you are all half heartedly in designing the feature named **Package Manager**. You don’t understand the use case of **Package Manager** at all. Unless the scope registry can be resolved from the package. Which I have trying and it was not

If you making feature named **Package Manager** you then must have thought about this. If not you should just name it **Unity Registry Package Installer UI** not a **Package Manager** or else it will become a false advertisement

---

<div class="post-metadata">

### Author: ![insominx](https://avatars.discourse-cdn.com/v4/letter/i/7ab992/32.png) [@insominx](https://discussions.unity.com/u/insominx)
#### Post date: [May 10, 2019, 10:14pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/8 "2019-05-10T22:14:04Z")

</div>

> [@k0dep](#):
>
> Hello to all! I partially solved this problem. Here is the link to the package: [github.com/k0dep/Originer](https://github.com/k0dep/Originer)

This seems to be limited to Github due to Topic. Is there a way to make this work elsewhere like off of gitlab?

---

<div class="post-metadata">

### Author: ![k0dep](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/k0dep/32/541052_2.png) [@k0dep](https://discussions.unity.com/u/k0dep)
#### Post date: [May 13, 2019, 11:04pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/9 "2019-05-13T23:04:23Z")

</div>

> [@insominx](#):
>
> This seems to be limited to Github due to Topic. Is there a way to make this work elsewhere like off of gitlab?

Yes, indeed, the current implementation has limitations associated with GitHub. Now I am working on the development of the whole ecosystem for working with packages regardless of their location, I plan to finish by the end of the month.

---

<div class="post-metadata">

### Author: ![Rock360](https://avatars.discourse-cdn.com/v4/letter/r/ecd19e/32.png) [@Rock360](https://discussions.unity.com/u/Rock360)
#### Post date: [May 17, 2019, 3:44am UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/10 "2019-05-17T03:44:35Z")

</div>

Hi.  
I found an awesome repo and thought it should be shared.  
This plugin looks like a PERFECT solution for me!

> **[GitHub - mob-sakai/GitDependencyResolverForUnity: This plugin resolves git url dependencies in the...](https://github.com/mob-sakai/GitDependencyResolverForUnity)**
>
> This plugin resolves git url dependencies in the package for Unity Package Manager. You can use a git url as a package dependency!

(From the README)

This plugin resolves git url dependencies in the package for Unity Package Manager.  
You can use a git url as a package dependency!

**Features**

- Easy to use: just install
- Resolve git url dependencies in packages
- Uninstall unused packages that is installed by this plugin
- Support GitHub, Bitbucket, GitLab, etc.
- Support private repository
- Support Unity 2019.1+
- Support .Net 3.5 & 4.x
- Update package with a specific tag/branch

**Install**

- Find Packages/manifest.json in your project and edit it to look like this:

```javascript
{
  "dependencies": {
    "com.coffee.git-dependency-resolver": "https://github.com/mob-sakai/GitDependencyResolverForUnity.git#1.0.0",
    ...
  }
}

```

- To update the package, change #{version} to the target version. Or, use [UpmGitExtension](https://github.com/mob-sakai/UpmGitExtension.git).

---

<div class="post-metadata">

### Author: ![Thaina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/thaina/32/93260_2.png) [@Thaina](https://discussions.unity.com/u/Thaina)
#### Post date: [January 6, 2020, 2:47pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/11 "2020-01-06T14:47:39Z")

</div>

@maximeb_unity Any updates?

If you still don’t do anything then please just bring code from [GitHub - mob-sakai/GitDependencyResolverForUnity: This plugin resolves git url dependencies in the package for Unity Package Manager. You can use a git url as a package dependency!](https://github.com/mob-sakai/GitDependencyResolverForUnity) into official UPM

---

<div class="post-metadata">

### Author: ![anon30979860](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@anon30979860](https://discussions.unity.com/u/anon30979860)
#### Post date: [January 13, 2020, 7:50pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/12 "2020-01-13T19:50:46Z")

</div>

Hi @Thaina ,

Git-based dependencies in packages are on the roadmap for 2020. I don’t have a specific ETA however.

---

<div class="post-metadata">

### Author: ![Thaina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/thaina/32/93260_2.png) [@Thaina](https://discussions.unity.com/u/Thaina)
#### Post date: [January 14, 2020, 3:07am UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/13 "2020-01-14T03:07:51Z")

</div>

> [@maximeb\_unity](#):
>
> Hi @Thaina ,
> 
> Git-based dependencies in packages are on the roadmap for 2020. I don’t have a specific ETA however.

Thank you. But still, could it be possible for opensourcing it, so we could contribute or just using it as is?

---

<div class="post-metadata">

### Author: ![anon30979860](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@anon30979860](https://discussions.unity.com/u/anon30979860)
#### Post date: [January 14, 2020, 3:55pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/14 "2020-01-14T15:55:47Z")

</div>

> [@Thaina](#):
>
> Thank you. But still, could it be possible for opensourcing it, so we could contribute or just using it as is?

I’m not sure what the plans regarding open sourcing it. At this time it’s not possible but I will pass the suggestion along. Thank you for your continued interest!

---

<div class="post-metadata">

### Author: ![nilsdr](https://avatars.discourse-cdn.com/v4/letter/n/58f4c7/32.png) [@nilsdr](https://discussions.unity.com/u/nilsdr)
#### Post date: [February 27, 2020, 9:41pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/15 "2020-02-27T21:41:03Z")

</div>

> [@maximeb\_unity](#):
>
> I’m not sure what the plans regarding open sourcing it. At this time it’s not possible but I will pass the suggestion along. Thank you for your continued interest!

can a custom package in scoped registry depend on another package that is in an other scoped registry? We have ar tools in our own registry which depend on the vuforia package, which is in their own scoped registry.

Can I somehow define in the package manifest that the vuforia package is to come from another scoped registry, or would I have to define vuforias registry in the importing projects manifest?

---

<div class="post-metadata">

### Author: ![Thaina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/thaina/32/93260_2.png) [@Thaina](https://discussions.unity.com/u/Thaina)
#### Post date: [March 17, 2020, 4:09am UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/16 "2020-03-17T04:09:57Z")

</div>

> [@maximeb\_unity](#):
>
> Hi @Thaina ,
> 
> Git-based dependencies in packages are on the roadmap for 2020. I don’t have a specific ETA however.

Unity 2020 is already beta. Where is git dependency support?

---

<div class="post-metadata">

### Author: ![Adrian](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/adrian/32/93991_2.png) [@Adrian](https://discussions.unity.com/u/Adrian)
#### Post date: [March 17, 2020, 4:13pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/17 "2020-03-17T16:13:49Z")

</div>

> [@Thaina](#):
>
> Unity 2020 is already beta. Where is git dependency support?

Unity 2020\*\*.1\*\* is beta. Maxime only said it’s on the roadmap for 2020, not if it’ll land in 2020.1, 2020.2 or 2020.3 (or at all – being on the roadmap is no guarantee).

I wouldn’t hold my breath waiting for it and look for alternatives in the meantime.

---

<div class="post-metadata">

### Author: ![Davidtr\_Unity](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/davidtr_unity/32/610088_2.png) [@Davidtr\_Unity](https://discussions.unity.com/u/Davidtr_Unity)
#### Post date: [March 17, 2020, 9:16pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/18 "2020-03-17T21:16:40Z")

</div>

Hi @nilsdr ,

Yes, this is supported. You would need to configure both scoped registries at the project level.

Hi @Thaina ,

Git dependency support didn’t make 2020.1 but it is still on the roadmap.

---

<div class="post-metadata">

### Author: ![Jerry-Lee](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/jerry-lee/32/906781_2.png) [@Jerry-Lee](https://discussions.unity.com/u/Jerry-Lee)
#### Post date: [April 7, 2020, 6:06am UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/19 "2020-04-07T06:06:22Z")

</div>

I suggest you use this: [https://openupm.com/](https://openupm.com/). It’s better choice for you to manage dependencies in unity package.

You can check my package as a dependencies example: [UniSharper.Core | io.github.idreamsofgame.unisharper.core | Unity Package (UPM) | OpenUPM](https://openupm.com/packages/io.github.idreamsofgame.unisharper.core/)

---

<div class="post-metadata">

### Author: ![Saucyminator](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/saucyminator/32/84895_2.png) [@Saucyminator](https://discussions.unity.com/u/Saucyminator)
#### Post date: [May 26, 2020, 6:11pm UTC](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000/20 "2020-05-26T18:11:29Z")

</div>

This issue I was having took a while to find. Please add this info in the Known issues thread.

[Next page](https://discussions.unity.com/t/custom-package-with-git-dependencies/732000.md?page=2)
