Unity Library folder vs. Source control

I started a Unity project that use GIT/GITHUB has a source control. I’ve read on the web that people suggest to not put the Library folder inside the source control because it change often and contain mostly binary data (which can’t merge correctly).

But, I’ve noticed that my GameObject was loosing there Script component if the Library doesn’t follow the Asset package. Resulting in a “MonoBehaviour: A MonoBehaviour Script is missing” error where the component should be.

After some research, I found that: "When backing up a project, you should always back up the main Unity project folder, containing both the Assets and Library folders. All the information in the subfolders is crucial to the way Unity works.

What should I do? Did any of you had this problem before?

You shouldn’t have to do that. First, make sure that you have meta files turned on: Unity Docs and that they are committed to your repository. Then always make sure to save your scene before you commit any further changes. This will update your scene file and any prefabs that you have modified. Also, if you’ve changed a prefab instance but intended to changed the prefab source, make sure to hit “apply” or drag it down again before the save.

This may be worth a read too: Unity with SVN. It covers using SVN but the workflow is similar.

Try this - unity docs: Using External Version Control Systems with Unity 4