Jakub Olejnik
Jakub Olejnik

Reputation: 71

A proper way to manage Unity Asset Store packages

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?

Upvotes: 6

Views: 2881

Answers (2)

Saucy
Saucy

Reputation: 175

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.

Upvotes: 3

Fredrik Andersson
Fredrik Andersson

Reputation: 121

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.

Upvotes: 3

Related Questions