7

I've gone through all the recommended steps to prepare a Unity project for a Git repository following the directions here:

Unity Git - Ignore Library

I've correctly setup the .gitignore file etc.

However when I clone my newly created Git repo on a different machine I noticed that my scene, assets etc. are missing. The scripts seem to be there.

I noticed that when I copy over the Library folder the missing things (scene, assets) come back.

I'm assuming that there is something in the Library folder that just can't be ignored or that the "forcing assets to text" just isn't working properly.

I'm using Unity 5.3.5f1.

I'm still fairly new to Unity/Git etc. so I may have overlooked something obvious but I've followed all suggested directions.

Any help would be much appreciated.

1
  • 1
    I totally agree. Everyone says the Library folder can be IGNORED but if you do so the Project BREAKS! Commented Jun 30, 2017 at 3:00

3 Answers 3

3

apparently Unity has changed the Library Folder many times in Unity 4.X that folder could be ignored. Now, it seems not.

I did some tests and the huge junk of files are for my in the ShaderCache and this folder seemed to be fine to delete. The other Folders should not be touched.

https://forum.unity3d.com/threads/26-581-bin-files-in-library-shadercache-folder-can-i-delete-these.326312/

2

Fell into same problem with Unity 2020.3

Some research showed that was needed files LastSceneManagerSetup.txt, CurrentLayout-default.dwlt for scene. And EditorSnapSettings.asset, EditorUserBuildSettings.asset for game window, game view and UI.

Maybe, I miss some other settings, so I saved files in Library root and replaced /[Ll]ibrary/ with:

/[Ll]ibrary/APIUpdater/
/[Ll]ibrary/Artifacts/
/[Ll]ibrary/BuildPlayerData/
/[Ll]ibrary/PackageCache/
/[Ll]ibrary/PackageManager/
/[Ll]ibrary/PlayerDataCache/
/[Ll]ibrary/ScriptAssemblies/
/[Ll]ibrary/ShaderCache/
/[Ll]ibrary/StateCache/
/[Ll]ibrary/TempArtifacts/
/[Ll]ibrary/UIElements/
1

Scenes are not entirely missing, as you can simply load them from Assets/Scenes. Their original order in the scene hierarchy, however, is lost.

I did even more tests than Jimmy and found out the only required things from Library are StateCache folder and LastSceneManagerSetup.txt file (less than 2 kB total in my case). Everything else located in Library folder can be safely removed.

Save these two:

  • StateCache/
  • LastSceneManagerSetup.txt

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