# In Unity, Meta Files are Tracked but Behaviours Fall Off

My team is working on a Unity game, and we are using a mercurial repository on BitBucket. Whenever we update, all of the behaviours 'fall off' of state machines, behaviours, etc. When searching for a solution, I discovered that this information was stored in the meta files. I had previously ignored the meta files, but the are now being tracked. However, the files still 'fall off'. I cannot find any other reason this would be happening.

Any assistance you can give me would be appriciated. Let me know if you need any additional details.

• That's right, unity generates a .meta file for each file, which it then uses for referencing it. So as you already pointed out, you should definitely add them to source control. I don't know much about mercurial as ever since I've been using git.. Two things to check: 1. Double check, that the .meta files were really committed, of course you'll have to fix the broken references once. Are you working with prefabs? 2. Check if the meta files somehow changed after their initial commit (they should not and I can't really imagine how, but who knows.) Hope this helps. – d4Rk Jul 9 '15 at 20:22

In Unity editor navigate to Edit -> Project Settings -> Editor, and:

1. Set Version Control to "Show meta files"
2. Set Assert Serialization to "Force Text"

Also update the .gitIngore File to something like this:

Library
Temp
*.sln
*.csproj
*.pidb
*.userprefs
*.unityproj
# Xcode
.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
*.xcscheme
xcuserdata/*

# eclipse specific git ignore
*.pydevproject
.project
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/

• I think you mean you "show meta files" that is usually what is recommend for checking a Unity project into version control. – James McMahon Aug 14 '15 at 14:53
• Opps my bad. Updated the answer – Zohaib Javed Aug 21 '15 at 10:02

Maybe I know whats is happening :), as you can read in the unity documentation:

http://docs.unity3d.com/Manual/ExternalVersionControlSystemSupport.html

When you use version control Unity has problems to manage the Library folder and you have to delete it manually. So the process is the following

1. Close Unity
2. Make a pull of the repository
3. Go to the folder where you have the unity project and delete the Library folder, that has to be in the same place that assets (this has to be done outside the engine obviously).
4. Open unity and develop your pretty game.

This procedure should fix you problem.

Cheers!

• You should never be checking the Library folder in anyways..It is just horrible programming practice in general to upload garbage files and binaries to your repo. – amza Jul 26 '16 at 21:02
• Thats totally truth, but if you dont realise in that its a quick solution. Bye! – Santiago murillo Jul 27 '16 at 19:35