The Unity of GameDev and Version Control
Objective: Install Unity, Set up a project and connect it with Git.
Unity. What is it?
Unity was originally set up in 2005 to make games. Since then Unity has expanded and now covers gaming in all platforms and types. It can make 2D, 2.5D, 3D, AR and VR games but is also used to make applications, animation, films, cinematogphy and is used in industry for maufacturing, construction, engineering, teaching and so much more.
Where to get it?
Unity is available for download on the Unity website. Unity comes in multiple plans ranging from free to thousands per month depending on your status and what you’re using it for.
To get started we can download the Unity Hub. This is a very quick install and will allow you to choose which version(s) of Unity you want to install. Unity Hub allows you to install multiple versions on the same system and choose which version you want to use for each project you create.
Once Hub is installed and opened we have four main sections to choose. You may need to set up an account with Unity and log in to proceed.
The first option in Hub is Projects. Here you can add existing projects from earlier versions of Unity or projects that have been copied from another system. You can also create new projects(We’ll come back to this).
The second option is Learn. These are sets of mini projects and interactive tutorials provided by Unity to get you started. They will guide you through Unitys interface, its functions and features, all while building and playing with small games and projects.
The next section is Community. This gives you access to groups, forums and blogs about using Unity along with projects and materials that have been made with Unity. It also gives you access to Unite Now. This is a large selection of Talks, Programming series, Demos and much more.
The last section is Installs. Here you choose the version(s) and featuresets you want to install. each version has some unique additions as Unity expands and grows.
As I have some versions installed, we can install the latest version with LTS (Long term support)
We have a wide range of platform support installs to choose from and Unity gives you the option of installing Microsofts Visual Studio Community during Unitys install. For those who another favourite IDE, you may be able to use that instead just check the documentation incase you need specific plugins or extensions. I will choose just Android, IOS, WebGL and Windows support and proceed. You can see the installation progress when the modal window closes and reveals your installing version faded off slightly until the installation finishes.
When ready click on the big blue button “ADD” and select the type of game you want to make. The next game for me will be a 2.5D game so I will go with the 3D setting. Set your project name and location where you will save the project. I would suggest creating a folder on the desktop or somewhere handy for you to save all your projects together. Your project names will have to be unique within the folder so once you’ve selected your game/project type, given your project a name and location, click the create blue button. This will create your project folder and add in the template files. This may take some time on your first run but it will open your project in Unity when done.
Since this isn’t about making the game itself we will now Unite the game folder and Git. Go to your GitHub and create a new repository. Choose your repository name, whether its Public or Private (I’ll go Public for this one). You can add a README file if you’d like. I would recommend adding a .gitignore file and choosing the Unity template. Finally add a licence if you need too before clicking on Create repository.
Open your project folder and inside the main folder right-click and Git Bash here.
Initialize your local repository with git init followed by connecting this repository with the one created on GitHub. You can get the link by clicking the Code drop down on GitHub.
Connect your local project to the GitHub repository. You may be asked to login to your GitHub account.
Use the command git remote -v to verify the link.
Next we can check what folders and items are needed to push to the GitHub repository. We do this using git status.
Now we add all these files and folders using git add . (This isn’t a full stop in this sentence as you will see)
Next we commit the changes(everything we just added), using git commit followed by -m “Initial Commit” (-m is for message and this message tells us that it’s the first or initial commit).
Finally we push the commit(copy all files and folders) to the GitHub repository using the git push — set-upstream origin master (double dash doesnt show on medium but you will see it in the next figure). Normally git push will do to send the commit but the GitHub branch was created using main and the local has been using master so we change branch and push while creating a new branch called master.
On my next post we’ll look at the Unity editor, set up a layout and start into some GameDev.