SVN vs Git for Unreal and Unity projects
This article will help you select the appropriate version control system for your Unreal or Unity project.
This article will cover Anchorpoint and Git LFS file locking, an essential Git feature for team collaboration, particularly when working with large binary files such as 3D models, animations, and Unreal assets. Using file locking, also known as exclusive checkout, is crucial.
Unlike code or text, binary files cannot be automatically merged, so if two people edit the same file simultaneously, one person’s work will be overwritten. File locking prevents this by allowing only one person to edit a file at a time. It notifies everyone else that the file is “in use” and protects the project from accidental overwrites.
Anchorpoint is a Git-based version control application designed for artists. It uses a real-time file locking system that is compatible with Git. It uses its own system that employs the Anchorpoint metadata server to share locking information. This system allows for the instant locking of binary and text files. Git LFS file locking is an entirely different system and should not be used with Anchorpoint file locking.
In Anchorpoint, binary files are automatically locked as soon as they are modified. Therefore, you don't have to lock them manually. These locks are removed as soon as the files are pushed to the remote server. However, the rest of the team must pull the files before the read-only protection is removed.
You can disable the auto-lock feature if you need it for certain situations. Go to Project Settings > Git. However, if you leave it on, you can lock the text files you want by adding their extensions to the "Auto-lock text files" input box.
In certain situations, you may need to manually lock files, which you can easily do in Anchorpoint by right-clicking on a file and selecting "Lock." The file will then be read-only for all team members, and your avatar and name will be displayed on it.
If you need to unlock a file for some reason, such as if a team member went on vacation and you need to continue working on the project, you can unlock the file by right-clicking on it. This action will be recorded on the project timeline for other team members to see.
Anchorpoint has its own Unreal integration plugin that helps developers push and pull directly from the engine while AP handles everything in the background. With this integration, you have more control over the process. Unreal will only lock the files when you check them out. Without the integration, AP will lock the files immediately upon change.
Similar to the Unreal plugin, the Anchorpoint Unity plugin allows you to commit directly from the editor and view locked files. Once you modify a prefab, Unity scene, or any type of binary file, the plugin automatically locks the file in both Anchorpoint and the Unity editor.
If you want to learn more about file locking in Anchorpoint, check out the official documentation.
For those savvy Git Bash users, there are Git commands that can lock files. The usual approach is to use Git LFS (Large File Storage), which has a lock/unlock feature for binary files.
Before locking files, ensure that Git LFS is installed and that the binary files are tracked.
git lfs install
Then to track certain binary files and make them lockable:
git lfs track "*.uasset" --lockable
git lfs track "*.fbx" --lockable
And then commit:
git add .gitattributes
git commit -m "Git LFS attributes file"
To lock a file, use the following command:
git lfs lock path/to/your/file
When you are done with the file, unlock it by:
git lfs unlock path/to/your/file
Sometimes you need to unlock a file that wasn't locked by you. In these situations, you will need admin rights, especially for cloud services like GitHub. To do this, use the following commands:
git lfs locks
This to see what files are locked, and then:
git lfs unlock --force path/to/your/file
In order to use the Git LFS locking system, you must register your text files as lockable using the Git LFS track method. In this example, we will track .txt files.
git lfs track "*.txt" --lockable