Using Git with Store Assets

Hello,

I am working on a Unity project for which Git is used as version control.

The project uses multiple assets, paid and free, from the Unity store in this project. The Unity store assets cannot be committed to the repository for licensing reasons.

Currently, after the project is cloned from Git, it is broken because the Unity store assets aren’t in the project. A user must open the project and import all of the assets from the Package Manager before anything works. Package Manager can’t be opened from Unity’s “safe mode”, so the project compiles without the assets it needs.

I want Unity’s editor to load all required store assets into the project when a project is opened for the first time after cloning with Git.

How can I set up my project to do this? Can I use Unity’s manifest.json to handle store assets like Unity’s other dependency packages?

2 Likes

I am also very interested, more generally what is the best way to define what packages (unity built-in and asset store) a project is using.

1 Like

Found an old thread saying a project cannot depend on store assets , so specifying URLs to store assets in manifest.json is not an option.

Is there really no way to import store assets into a project before the project loads and compiles?

1 Like

New reply helped me find this older thread, which might be the closest thing to answering my question: Can you have packages be dependent on Asset store packages?

In case the link disappears, here’s the most important info:

  • “You cannot have a dependency on a .unitypackage”
  • “The long term goal is for the Asset Store to move to the new UPM format so one day you’d be able to add a dependency on your favourite Asset Store packages”
  • “But as of today, the scenario you describe isn’t really possible without a hacky workaround”

The best workaround I have for now is to make a locally stored project that only contains the plugins downloaded from the asset store/package manager, then copy the assets needed to the newly cloned main project wherever they need to be, then open Unity and let it do its thing.

(Alternatively, and most simply, one could just commit the assets to their repository, but that obviously breaks my requirement of not doing that. Anyone intending to do this should read the licenses of each package to make sure all contents are covered under Creative Commons or MIT or something, particularly if your repository will be public.)

As for defining what packages a project uses, I intend to note the required assets in a project’s README file. There’s probably a better solution, but I’ve run out of investigation time on this issue for now.

EDIT:
The approach below may run into trouble if the packages have their own installers or if you have to change script execution order to make packages work. This may be because files (including meta files) under packages are considered immutable by Unity.

One other thing I found is you can have dependencies which link to a git repository. The two most interesting things in that article are 1. it looks like you could host some files on localhost, and 2. you can specify a path for when the files you need aren’t at the root of the repository. More information here: Unity - Manual: Git dependencies and Unity - Manual: Local folder or tarball paths.

Using that approach, you could in theory host your own Git repository with the store/UPM assets on it and only pull the ones you need per project. This would meet all the original requirements, plus it would remove the README bit I mentioned above (the assets would be listed in the Unity project’s manifest.json). Might be an option for projects where more than one person works on them.

Possibly overkill, but putting the info out there in case it helps anyone.

4 Likes