Working with Unity Package Manager and repositories

Unity Package Manager was added in 2017.2.x.
When upgrading our project, we saw that it creates a bunch of empty folders for packages in the project folder, as follows:

.
└── Packages
    ├── com.unity.ads
    ├── com.unity.ads@2.0.3
    ├── com.unity.analytics
    ├── com.unity.analytics@2.0.13
    ├── com.unity.purchasing
    ├── com.unity.purchasing@0.0.19
    ├── com.unity.standardevents
    └── com.unity.standardevents@1.0.10

All of them are empty. This raises a few questions:

  1. Are those empty folders actually used? Removing them and re-opening the project seems to re-create them.
  2. Do they need to (or should) be checked into the project repository? Since they are generated empty, they cannot be added to Git or Mercurial (which is what we use).
  3. How do we pick or pin specific packages or versions of those packages? The Unity Package Manager manifest is empty:
$ cat UnityPackageManager/manifest.json
{
        "dependencies": {
        }
}
  1. How do we guarantee that our project is built with the same versions across all developer machines and build machines? The last thing that we want is one of the machines to randomly pick a different version of a package and produce different results!
    4a. I tried moving the contents of those packages from my local user folder into the project folder and repository, but the moved files do not seem to be used, and instead the ones in local user folder get repopulated.

Some more information, help and guidelines regarding this would be much appreciated!

I got some answers at How to work with Unity Package Manager in Unity 2017.2.x+ - Questions & Answers - Unity Discussions

In short:
2. Only UnityPackageManager/manifest.json should be checked in as noted in https://docs.unity3d.com/Manual/ExternalVersionControlSystemSupport.html
3. and 4. Apparently not possible in 2017.x, but should be possible in 2018.1?

One open question remains:
Is it possible that in Unity 2017.2 or 2017.3, Unity will “randomly” decide to update one of these packages on its own on one of our development or build machines?

1 Like