6

I'm new to Unity and I'm uncertain how to properly manage Asset Store packages. What I've been doing so far is downloading them through Package Manager and importing them into the project and simply commiting them to my git repo. I feel like this is not an optimal way to do things and just makes my repo bloated.

I imagined the solution to be like a classic package manager (pip, npm, nuget etc.) and stumbled upon this thread from 2018. The respones suggest that commiting everything to your version control is the way to go.

Is it still true in 2022?

1
  • Asset store packages are now (I think since Unity 2020) imported via the unity package manager as well. see docs.unity3d.com/Manual/upm-ui-import.html ... they still end up in Assets though so you probably still will have to commit them into git
    – derHugo
    Commented Apr 8, 2022 at 12:14

2 Answers 2

3

My Solution for version control right now is to put my entire asset folder into .gitignore, and simply unignore my game folders along with anything I need to include in version control. This has worked quite well so far. You just have to make sure to put everything you want to include into the correct unignored folders (I usually create my own prefabs anyway, so this isn't a problem for me).

It's not perfect, but it's the best solution I've found.

If I make changes to imported assets, I move the specific files over to my own project folder that is not ignored. It's easy to forget things like terrain data that usually lands in the asset root folder, but you get used to it.

So, a typical .gitignore would end something like this.

Assets/*
!Assets/_[Mm]yproject/

Hope it helps.

3

The way I'm doing it is I have a clean project where I download & import the asset store packages through Unity Package Manager. Then I create a custom local package (I call them "wrapper"-packages), more information on packages here: https://docs.unity3d.com/2021.3/Documentation/Manual/CustomPackages.html https://docs.unity3d.com/2021.3/Documentation/Manual/CustomPackages.html#LocalMe

In the new custom package I put the downloaded content in and add Assembly definition files if needed due to most assets have no namespacing or even use ASMDEF files at all. I setup the required references if needed. ASMDEF info here: https://docs.unity3d.com/2021.3/Documentation/Manual/cus-asmdef.html

This way I can add the package to any project I wish with ease. I also add the package to version control so I can keep track if there's any changes I accidentally made while using it.

The only changes you'll see in your projects git history is changes to manifest.json and packages-lock.json files in /Packages because the content is outside the project and not tracked.

1
  • I'd like to go that way also. Did you find a way to ensure package versions ? I believe you can't target a specific package version from the store. In case of a necessary recovery you would end up having updated packages and possible breaking changes. But maybe it is a fare trade regarding the obvious gain.
    – StackHola
    Commented May 30 at 9:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.