- Home /
Git and Unity not working correctly: missing components, textures, materials, etc.
I'm currently trying to use Git/GitHub with my current Unity project and I'm having problems objects and their components/materials. For example: On my main computer the scene and assets look like this:
Scene: http://puu.sh/nKWX3/24a63ff8c8.png
Materials: http://puu.sh/nKWYc/cc1d95ef2d.png
But when I do a pull on my laptop or any other computer for that matter, I get this:
Scene: http://puu.sh/nKWVM/0bdb89b916.png
Materials: http://puu.sh/nKWWc/6dbd4c6a27.png
The Unity project is set to have "Visible Meta Files" with "Force Text" as their asset serialization, and my .gitignore look like this: (Default/master one for Unity from GitHub)
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/Assets/AssetStoreTools*
# Autogenerated VS/MD solution and project files
ExportedObj/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
# Unity3D generated meta files
*.pidb.meta
# Unity3D Generated File On Crash Reports
sysinfo.txt
Has anyone ever come up with this problem before and solved it? I've done a lot of searching and nothing has solved my problem so far.
Answer by Centribo · Mar 18, 2016 at 03:20 PM
Well, this is completely my fault, but I had deleted all .mtl files, not knowing what they do, and this caused Unity to not know which materials go on which objects, so Unity generated them all from scratch.
Lesson: Don't delete files if you don't know what they do and your repo will thank you for it.
Answer by Polymo · Mar 18, 2016 at 03:23 PM
I haven't tested it myself, but there's UnityYAMLMerge http://docs.unity3d.com/Manual/SmartMerge.html which should help with merging correctly.