5
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – d4Rk Jul 9 '15 at 20:22
2
\$\begingroup\$

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
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I think you mean you "show meta files" that is usually what is recommend for checking a Unity project into version control. \$\endgroup\$ – James McMahon Aug 14 '15 at 14:53
  • \$\begingroup\$ Opps my bad. Updated the answer \$\endgroup\$ – Zohaib Javed Aug 21 '15 at 10:02
0
\$\begingroup\$

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!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – amza Jul 26 '16 at 21:02
  • \$\begingroup\$ Thats totally truth, but if you dont realise in that its a quick solution. Bye! \$\endgroup\$ – Santiago murillo Jul 27 '16 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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