- Home /
Build platform doesn't stick when using VCS (Git)
I'm using a BitBucket Git repo just as my own private repository for a side project in Unity. I have Unity Pro (with iOS). Simple problem really - when I first committed my code, I deleted the Library folder. I also added the following to my .gitignore:
# Ignore The following directories / file extensions
Library/
Temp/
# Ignore the following file extensions
*.exe
*.vcproject
*.sln
*.pidb
.DS_Store
._*
.Spotlight-V100
.Trashes
Icon
.AppleDouble
.LSOverride
# Autogenerated VS/MD solution and project files
*.csproj
*.unityproj
*.sln
That's put together from a variety of sources for OSX and Unity .gitignore files I found.
I deleted the Library folder, committed, then re-opened the project. For some reason, my project had reverted back to being a PC and Mac Standalone project and forgotten that it was an iOS project.
Is there a file in the /Library folder I should be not ignoring so Unity remembers the build platform?
Hi Eshan. Did you manage to solve this one? I too am using Git and am dismayed at the documentation around what files within library are required. I'm using Unity 4, I notice your gitignore looks very different to the one here:
Answer by AnomalusUndrdog · Apr 07, 2013 at 06:43 PM
Current build setting isn't saved in version control.
Imagine this: one working copy is configured to compile the iOS version of the game, and another working copy is configured to compile another version, say, the Android version.
If which platform to publish to was saved along in version control, those two people working on separate versions of the game would mess each other up.
And if you ever developed cross-platform games in Unity you would know switching from one platform to another is incredibly slow, as it reimports all the assets for the platform to switch to (would be nice if it keeps imports of assets per platform to prevent that though).
Don't version control the Library folder. That will mess up your project. Unity can reliably recreate the Library folder anytime, provided that you enabled meta files in your project.
I understand what you are saying - still it feels like a forgotten part. If I do a copy of my "iOS project", only copying the Assets and ProjectSettings folders, and open that in Unity later, the scenes look whack because it forgot the selected build platform and also in Game view it shows something like a 1024x768 view ins$$anonymous$$d of iPhone 5 Tall (9:16), making everything just look broken.
Answer by dannyskim · Oct 22, 2012 at 05:21 AM
Have you looked at the library folder at all of a project?
It stores all your metadata and build editor settings... The specific file your'e looking for is probably either EditorUserSettings.asset or EditorUserBuildSettings.asset, but that's besides the point.
The library holds all your settings information AND your metadata associated with settings for each item in your Assets folder. Needless to say, you need that folder if you're using a repository or version control, and even if you're not and delete the folder, your project will most likely get messed up upon recreation of the folder.
Your best bet is to read Unity's documentation for this:
http://docs.unity3d.com/Documentation/Manual/ExternalVersionControlSystemSupport.html
I don't think that's correct - everywhere I've read has recommended ignoring the Library folder completely. I quote from the link you posted:
"The Library directory should be completely ignored - when using external version control, it's only a local cache of imported assets."