I recently got a MacBook Air to serve as a mobile-friendly companion to my iMac and it got me thinking about how to deal with Unity installs. I had primarily been working on a single machine without any team members to worry about. Therefore my one machine, and the Unity versions on it, were all that mattered. But as I was setting up my new MacBook air I quickly realized that onboarding that machine to the project (much like you would for a new team member) was not as easy as you might think.
Real-world comparison
As someone who’s spent well over a decade developing for the web, I immediately drew comparisons to Ruby and RVM. To those unfamiliar with those: Ruby is a programming language that has enjoyed a ton of success due to the Ruby on Rails framework and RVM is a tool used to manage multiple versions of Ruby on a single machine. Now, how does this work in the real world?
Let’s say you’re a web developer and you’re starting a new website. You choose Rails (because it’s great) and since this is a fresh spanking new project you get to use the latest version of Ruby. Let’s say that version is Ruby 2.5.3.
Months go by and you’re hammering away getting features done. During that time the latest Ruby could creep forward. Maybe 2.5.4 gets released to patch a few things. Maybe 2.6.0 gets released and has a slew of great new features. Depending on the needs of your project you may choose to update your project to the new versions of Ruby, or you may be perfectly fine with the feature set available in your current version. Let’s say we never upgrade Ruby.
A year later, when you’ve completed that awesome project, you decide to start a new website. You know that this project is going to want to make use of something fancy that was added in Ruby 2.6.0. You use RVM to install a new Ruby alongside all the others you’ve got. Here’s an example of my current machine:
Don’t worry about these Ruby versions matching my ongoing example. I just wanted to show how you can have multiple versions of Ruby all sitting on one machine. Each of your projects is tied to a single version of Ruby. That makes it important to, at the very least, keep all the Ruby versions around that are utilized by projects we plan to work on in the future. They’re intrinsically linked. Okay, enough of that. Back to Unity.
Unity versions and the Unity Hub
If you understood the Ruby comparison above you may have worked out the comparison in the Unity world. Unity (the editor) is like Ruby and Unity Hub is like RVM. We do our work and write our code in a specific version of Unity and can use Unity Hub to manage those.
Now, I will say using Unity Hub is not as nice of an experience as using something like RVM. It doesn’t seem to be great about plucking very specific releases to install. Here’s an example.
The Install tab in Unity Hub looks like this on my machine.
Okay, so let’s say I’m building a game against Unity 2018.2.11f1. Fantastic, now let’s say I’ve hired a new person or I’m setting up a new machine, and I check out all the source code. Great, but that’s only half the battle. I still need the correct Unity. Okay, let’s go get it. I’ll click on Official Releases and just download it in Unity Hub.
Hmm. I need 2018.2.11f1 and it’s not here. I can’t simply download the most recent version because I could potentially run into upgrade conflicts in addition to forcing everyone else on the team to upgrade their Unity versions the second I checked things into version control.
So what do I do?
In RVM I could simply type rvm install 2.6.0
to get a new version of Ruby. Super easy. In the land of Unity I think you have two options:
- Visit their website to search for your desired version.
- Pass it manually from a machine successfully working on the project. If you’re on a Mac the path to your Unity installs is
/Applications/Unity/Hub/
Placing a Unity version directory at the above location ensures that you can utilize it when Unity Hub fires up.
Make it easy and put it in the README.md
If it were me I’d drop a direct link to the correct Unity version right in the README so new folks can get up and running quickly. It could also help people new to this whole game development world, like me!