Table of Contents
Whether you are just starting with Unity, reinstalling your operating system, or helping a friend; we all have to setup development environments. I frequently do this and there are several essential things needed for a well rounded environment. I hope to share my insights so that you can create your own environment and start making games in Unity right now.
Programs to install:
- Unity (the installer includes Visual Studio, the IDE I use)
- git (see below)
Step 1: Install Unity and IDE/Text Editor
Edit > Preferences... > External Tools and browse to find your editor of choice.
Step 2: Install Git
Windows 10 recently added the Windows Subsystem for Linux which allows you to run Ubuntu Bash. This is my favorite way to use git on windows. You can install WSL and run
sudo apt install git, or alternatively get native applications of git, including some GUI applications like Sourcetree or GitHub Desktop.
If you aren't familiar with version control, you should be. It allows you to backup your project, tag points in time that can be referenced later, and easily work with a team or on an open source project. I can't overstate this! Please trust me when I say it will save you from frustration in the future. Learn git and go backup your projects now. Both github and bitbucket offer good free options.
If you're a student, go get the GitHub Student Developer Pack.
Step 3: Creating a Project and Changing Project Settings
Open Unity and log in to your account to be able to create a new project. You can choose where to save your project and whether or not it should be 2D or 3D. If you create a project and it’s not the dimension you want, you can change between 2D and 3D by going to
Edit > Project Settings > Editor. Some versions of Unity contain a bug that creates a project and it doesn’t use the dimension you asked for, if that happens, just change your settings and then create a new scene to see the correct camera style.
Each time you create a new Unity project, you’ll need to change some settings to work with version control. I’m assuming this methodology will work for more than just git, but that’s what we will be using. Inside your unity project, go to
Edit > Project Settings > Editor and change
Version Control to
Visible Meta Files. You will also need to change
Asset Serialization to
Force Text. Most version controls work in deltas or diffs, and it’s a lot easier for them to work in text than binary.
Step 4: Creating a Repository
You will now need to setup your repository, repo for short. You can make a repository in two ways, whether or not you have or haven’t started your project yet.
The first way is through bash (or your command line):
mkdir my-new-project cd my-new-project git init
The second way is through an online interface: github(shown) There are some important settings when creating a repo on Github:
Public/Private toggleIf you have paid/copyrighted assets you should either not commit the assets to the repository or have a private repository.
Readme & licenseIf you are creating something open source, a readme and proper license are important and informative. MIT is a very permissive license for open source.
.gitignore Is a special file that tells git what we don’t want committed to the repository. This is used for binaries, assets, and Unity Editor/IDE created files that only slow things down and cause headaches for us and others accessing our project. github hosts the unity one like is selected above.
If you went the command line route, there will be a hidden file named
.gitignore in the root of your repository. You can open it and view it in a text editor. It should be the very first thing you commit. The
.gitignore below will assume you have your Unity Project at the root of your repository.
If you want your Unity Project to be nested or to have multiple projects in this repo then simply remove the leading /
/[Ll]ibrary/ /[Tt]emp/ /[Oo]bj/ /[Bb]uild/ /[Bb]uilds/ /Assets/AssetStoreTools* # Autogenerated VS/MD/Consulo solution and project files ExportedObj/ .consulo/ *.csproj *.unityproj *.sln *.suo *.tmp *.user *.userprefs *.pidb *.booproj *.svd # Unity3D generated meta files *.pidb.meta # Unity3D Generated File On Crash Reports sysinfo.txt # Builds *.apk *.unitypackage
iii: Committing and Pushing
Move your Unity project into your repository folder. You’ll need to close Unity before doing this. Now that we have our gitignore it will be safe to move it all over as we only will add
Project Settings/ to commit as the rest is autogenerated by Unity and our IDE. Unity project structure usually looks like this:
Sometimes when you’re moving a project, a Unity Lock file won’t want to move and will cause trouble, skipping that file is ok.
my-new-project/ ├── Assets ├── Library ├── ProjectSettings
The following commands will add the files in your new project to be committed, review the commit, make the commit, then push to your remote (Github etc). If this is confusing, again, Learn git.
git add Assets/ ProjectSettings/ git status #Review what we have staged before committing git commit -m 'Initial unity project commit.' git push origin master # If you are setup to a remote like github/bitbucket
Step 5: Find, Create and Edit Assets
Now that you have a project and a repo, you’ll need some assets for your game, and ways of dealing with them.
- Open Game Art
- Kenney offers free assets on Open Game Art, but he does amazing work and it’s definitely worth it to support him and buy his art
Creating and Editing Assets:
Cool People and Repositories:
You are now ready to begin (or continue) your game development journey. A few bits of closing advice:
- Commit atomically and commit often
- Write meaningful commit messages
- ALWAYS push new commits to your remote
- Use git tags for milestones
- Have a well organized unity project
- If you are working solo it is generally fine to work off the master branch. If you are working on a team, learn the power of branches and decide on a workflow(1, 2, 3, 4) with your team to avoid conflicts and wasted time.
Good luck explorers!