Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity meta files and git branching

We're using "Visible Meta Files" as our internal version control at the moment (if it's not the correct approach, we wouldn't have a problem changing it), but currently confused as to what's best to do when working on a branch.

For instance, latest work that I've done, is implement an IAP plugin, which created loads of folders and files in different places in the project, as well as the meta files connected with them all.

I went about this in my normal git work approach, by doing the work in a branch, and then bring it into the master branch when it's ready. Unfortunately, if I do this, when I have to do some work on another branch, when I swap to that branch, Unity recreates all these meta files from the folders created on that other branch, that then mess up any sort of clean merging, or similar.

Thusfar, what I've chosen to do is, when merging, close Unity, delete all these leftover meta files / allow the merge to overwrite local files, but I'm assuming there must be a better way to do this, no?

like image 850
seaders Avatar asked Dec 10 '14 11:12

seaders


People also ask

Does Unity work well with Git?

Git works best with code text files, like your Unity C# scripts. But it can also work with all your project files including binary assets like images, audio, and 3D models, as well as other files created within a Unity project (scenes, prefabs, materials etc), which are text data files in YAML format.

Should I commit meta files Unity?

Yes. Unity's . meta files form a critical part of your project and hence should be committed to your Version Control System.

How do I view meta files in Unity?

Unity creates these files for each asset, but they are hidden by default, so you may not see them in your Explorer/Finder either. You can make them visible by selecting this option in Unity: Edit > Project Settings > Editor > Versions Control, Mode : Visible Meta Files.


1 Answers

This an annyoing behaviour of Unity. Just make sure to to properly commit/push the meta files. I recommend having multiple 'local copies' of the branches you work on and only handle the meta files once you merge/re-integrate the new features. This way you will treat them as separate projects in Unity.

like image 78
aggsol Avatar answered Oct 06 '22 18:10

aggsol