Week 7 - Version control with Unity3d
- Anouk Dutrée
- 23 jul 2021
- 5 minuten om te lezen
What is version control?
Version control helps you as a developer, or as a team, to keep track of changes made to the system. Because of this tracking you can easily experiment with new features. If you don’t like how they turn out, you can safely rollback to an earlier version. This is particularly helpful when one of your changes accidentally crashed the system. No need to panic if that happens if you’re using version control. Just perform a rollback and you are good to go!
Version control systems (VCS) are the systems that perform version control. There is a large variety of these systems out there fit for different purposes. In this blogpost I will share my thoughts and findings on what version control to pick when working with Unity3d, the game engine I’m currently working with.
Personal experience with version control so far
Personally, I use Git. I first learned Git a couple of years ago during a minor in Computer Science and I have used it ever since. Git has quite a steep learning curve but it is definitely worth it. It is used virtually everywhere where coding is involved and it has an abundance of features to help you in your development. I am also using Git at my current job so it has become a daily practice for me.
There are different ways in which you can use Git however. At work we use GitLab and I use git bash to interact with it. For personal use I tend to work with GitHub with git bash. The reason for this is that GitLab is very well suited for enterprises with tons of enterprise features, and GitHub is good for personal projects as it is easy to opensource. Because GitHub is so open it also acts as a small portfolio of what you can do.
When I first got introduced to Git I remember it was quite overwhelming. It was also my first time working with a command line tool (git bash). We had to because my professor at the time said “We are not going to baby you. In real life software developers live in the terminal, so it is good practice to get used to it.”. He was right, and I am thankful that he pushed us to use the terminal instead of a GUI client. Once you know your way around the terminal you don’t want to go back. Working with git bash is so incredibly fast, much faster then when you have to click around a GUI all the time.
What VCS to use with Unity3d?
Unity3d is of course very different from regular software development, so there are some additional considerations when picking a VCS tool. The main difference is that when you develop a game in Unity3d, there is much more than just code. In addition, you also have all your graphics components like your 3D models and textures. I figured it was about time to dive into the pros and cons of different VCS systems for working with Unity to find the best choice for my needs.
I looked through multiple discussions on Reddit, StackOverflow and the Unity Forum, as well as some personal blogs to get an overview of the VCS tools for game development. Git and Perforce kept popping up as go-to tools(Best Version Control for Unity - Unity Forum, 2019; Richmond, 2013; Whitehouse & Matthews, 2018). Some peers had mentioned using Unity Collaborate in some of the peer discussions as well, so I dove into that on too. Here are the pros and cons I found:
Git (with GitHub)
The pros:
- Free!
- Distributed VCS
- Advanced branching possibilities
- They host and manage your server
- Unlimited private or public repositories
- Easy to collaborate with others
- Possible to host an accompanying website in the same repository
- In general, very feature rich (in terms of CI/CD for instance or integrations with other services for instance)
- Large community and easy access to help
The cons:
- Commit history bloats when working with large (>5 MB) media files
- Repository size should remain under 5GB (for GitHub)
- Can’t merge scenes
- Steep learning curve
Perforce
The Pros:
- Made to work with game engines
- Appears to be industry standard for AAA game studios
- Good with large files
- Locking mechanism to lock assets
The Cons:
- It is paid, price in the range of several hundred dollars per user
- Appears to have a steep learning curve
- Little adoption by indie game developers
- Smaller community
- Requires a connection to the server which can make several operations slow (Atlassian, n.d.; Perforce vs Git : Gamedev, 2018)
- Branching is more difficult as it is per-file basis which can cause performance issues (Atlassian, n.d.)
Unity Collaborate
The pros:
- Made to work with Unity
- Easy to collaborate with others
- Good with merging scenes
- Easy to use and simple
The cons:
- No branching possibilities
- Only basic features due to simplicity
- For a free subscription max 3 collaborators and 1GB
- For more it is paid, but small price (9 dollars a month)
Looking at this pros and cons list I am most inclined to use GitHub. Since I am still in the beginning of my game development journey, I don’t feel like spending money on a VCS system just yet when I have a really well functioning free one at my disposal. The fact that Git is a distributed VCS also gives it a big plus over Perforce. A distributed VCS has multiple advantages over a centralized VCS, of which two key ones are the ease of merging branches and the ability to easily work offline (Sillito & de Alwis, 2009). However, the large file limitations of Git is a problem of course. Especially considering the games I am interested in developing. Luckily, GitHub released a plug-in for Git in 2015 for working with large files: Git LFS (Olson, 2015). Git LFS seems to be the perfect solution to Git’s limitation in working with large files. I have not had the time to try it out just yet but the documentation looks straightforward and it was mentioned several times in different discussions (Best Version Control for Unity - Unity Forum, 2019; Richmond, 2013; Whitehouse & Matthews, 2018). In my next project I will give Git LFS a try to see if it lives up to its promise.
The other disadvantage of using Git is its steep learning curve. Since it has so many features it takes a while to wrap your head around it. However, I have been working with Git for a couple of years now and I feel comfortable with it. So for me that is not an issue. If I wouldn't be familiar with Git I would have been inclined to give Unity collaborate a try. But now that I am so used to working with branches to keep track of everything I don't think I can go back to a system that doesn't have that.
Considering that the file size limitation appears to be easily solved, and that the steep learning curve is no problem for me, I think that GitHub with Git-LFS is the best option for VCS for me. I will continue using GitHub and in my next project I will make sure to try out Git-LFS as well.
List of References
Atlassian. (n.d.). Perforce to Git - why to make the move | Atlassian Git Tutorial. Retrieved August 1, 2021, from https://www.atlassian.com/git/tutorials/perforce-git
Best Version Control for Unity - Unity Forum. (2019, April 5). https://forum.unity.com/threads/best-version-control-for-unity.656572/
Olson, R. (2015, April 8). Announcing Git Large File Storage (LFS) | The GitHub Blog. https://github.blog/2015-04-08-announcing-git-large-file-storage-lfs/
Perforce vs Git : gamedev. (2018).
https://www.reddit.com/r/gamedev/comments/a1khv0/perforce_vs_git/
Richmond, S. (2013, October 6). Using Git with 3D Games. https://www.strichnet.com/using-git-with-3d-games/
Sillito, J., & de Alwis, B. (2009). Why Are Software Projects Moving From Centralized to Decentralized Version Control Systems? 2009 ICSE Workshop on Cooperative and Human Aspects on Software Engineering, 36–39. https://doi.org/10.1109/CHASE.2009.5071408
Whitehouse, W., & Matthews, D. (2018, July). git - Unity Collaborate vs GitHub - Stack Overflow. https://stackoverflow.com/questions/50855967/unity-collaborate-vs-github






Opmerkingen