- Home /
Is Library folder necessary?
I am so confused. In this article it's said that Assets and Library folders are necessary. http://docs.unity3d.com/Manual/BehindtheScenes.html But other articles said only Assets and ProjectSettings folders are necessary. I am so confused why there are different ideas.
Answer by duck · Jun 25, 2015 at 02:49 PM
Hi, it looks like you may have found a piece of outdated information in the manual. (EDIT: this page has now been updated). Before we introduced separate ".meta" files which are stored in your Assets folder, this was true - the Library folder used to contain cached data & meta data.
However, in the Current version of Unity, we store the meta information alongside your asset files. The only data stored in the library folder is cached data which can be re-generated from your assets and their accompanying meta files.
The Meta Data stored in the .meta files in your Asset folder is the information and settings specified in the inspector when you examine an asset. Every file in your Asset folder should have a corresponding .meta file. For example, an image file's meta data would contain the settings for Texture Type, Wrap Mode, Aniso Level, Max size, etc. For a .FBX model file this would be the Scale Factor, mesh compression setting, Rig settings, Animation import settings etc. You can open these .meta files in a text editor and see the settings if you like.
Conversely, the Cached data in the Library folder is the game-ready imported data that has been extracted from your source asset according to the import settings that you specified in the inspector. For example - your source asset may be a PSD file, but graphics hardware can't use the data in that format, so the image is read & stored in a different format in the Library folder, ready to use as a texture. Similarly, for an FBX file - the model data, materials, animations, etc are all extracted and stored in a game-ready format in the Library folder.
If any of this cached data in the Library folder is missing, it can be re-created by Unity. All it needs are the source asset & the settings in the corresponding .meta file.
This is why, when checking your files into a version control system, you should only include the Assets and ProjectSettings folder.
(I'll add a note to get that Manual page updated!)
Thanks $$anonymous$$r Duck for your reply. The version I use is 4.3. Does this matter? I noticed there are meta data alongside with each file which means it will build the whole project properly. But when I only use Assets and ProjectSettings folders to reimport the project, there are missing some mesh filters. $$anonymous$$eshes can not be chose from assets folder as well. Can you explain why that happened?
Yes it does matter which version of Unity you're using. If you're using an old version of unity, you should refer to the old version of the $$anonymous$$anual (either installed on your computer, or here for the 4.3 manual )
The meta data contains vital information about how you have chosen to import your assets, and where they are used, so if you don't copy meta data files when you copy assets, you'll lose those import settings and usage references.
FYI the outdated information on the page has now been updated:
http://docs.unity3d.com/$$anonymous$$anual/BehindtheScenes.html
Hello Duck, can you please take a look at my question here http://answers.unity3d.com/questions/1142554/removing-library-folder-breaking-the-project.html
$$anonymous$$y scene breaks if I removing Library folder (or if I'm not including it into the source control)
Thank you!
Answer by thomas4d · Dec 03, 2020 at 04:08 AM
Be careful I found this thread and deleted my libaray folder But Lucky Zipped my project before I deleted the Library folder, (as it was 13 gig the rest of the project was under 5 gigs. )
I got my project back, BUT when I did deleted the Library folder Unity crashed and crashed every time I tried to load the scene this is with Unity 2019.4.13f1 the only way got my project back was Restore the zipped backup..
in theory, Duck may be right sound all solid info ,. but in the real world be careful...
Answer by ken_unity779 · Apr 11, 2021 at 09:18 AM
As I understand it, you should be able to delete Library and count on Unity to rebuild it (and ignore it in version control). However, as @thomas4d has pointed out, reality may differ. I recommend backing up your project before deleting Library. If it breaks, restore the Library directory from backup.
Then, you should try to troubleshoot it. Delete a few subdirectories at a time and reload until something breaks, then narrow it down. It's important to be able to rely on Library functioning as a cache. Otherwise you can't effectively use version control or cloud build.
That's what I'm doing next. I'll try to remember to post my results in a comment below...
This file fails to regenerate if deleted: Library/LastSceneManagerSetup.txt
... and based on that insight, I found this gem: https://stackoverflow.com/questions/38024383/excluding-library-folder-from-git-for-unity-project-causes-scene-to-be-lost
Hope that helps.
Your answer
Follow this Question
Related Questions
Removing Library folder is breaking the project 3 Answers
Managing the Library Folder 0 Answers
Unity AssetStore folder in Mac Library directory 0 Answers
Save image to resource and display 1 Answer
How do I enumerate the contents of an asset folder? 2 Answers