Setting Up a Unity Repository

by @stephaniePocci

March 13, 2023 • 5 min read

Getting Started

Before we begin, make sure you have both of the following downloaded:

  • GitHub Desktop
  • Unity engine version 2021.3.18f1 downloaded. Any version of Unity should work as long as it is 2021.3.18f1 and after! 1

In order to download multiple Unity versions, please download Unity Hub first. You'll need to create an account and agree to the free personal license as prompted.

Minimum System Requirements

The following are the system requirements in order to be able to run Unity engine:

  • Windows 7+, Mac OS X 10.13+, Ubuntu 16.04, 18.04, or CentOS 7
  • Minimum 6GB of free space on your disk

Your First Project

1. Creating a Unity GitHub repository

To keep this simple, please follow along with your downloaded version of Github Desktop! Ensuring your Unity project is linked to GitHub is a semi-complicated process if you're not familiar with it. That's why this guide is here to help you!

  • Open GitHub Desktop and select File > New repository
    image
  • Fill out the fields in the pop-up menu. Be sure to set the git ignore to Unity
  • Be sure to also initialize a README.md file so we can push this repository to GitHub.
  • Don't forget to select Create Repository once you're finished with the settings!
  • After you've created the repository, feel free to commit and push your current changes/settings to GitHub.
    image

2. Creating a new project in Unity

If you're following along with the workshop, please double check you have Unity Hub and Unity version 2021.3.f1 downloaded.

  • Open Unity Hub and select New project (it will be in bright blue on the top right-hand side)
    image
  • In the new menu, be sure to select 2D Core and change the Project name to your liking
  • Most importantly, open File explorer by selecting Location, and setting it to the folder of the repository you just created (If you're using Windows, it should be under Documents > GitHub if you didn't change any settings)
  • Once you're done, don't forget to select Create project
    image
  • If you've done everything correctly, you should see the project you created in the Hub like this:
    image

3. Open your Unity project

The first time you open your project, depending on your RAM you may have to wait a little while for Unity to do first-time setup. This occurs for each new project you make. Don't worry though - this is only for the first time setup - so hang tight!

  • To open the project you just created, go ahead and just select your newly created project in the Unity Hub
  • If everything went smoothly, you shouldn't see any warnings or errors and you will see the main Unity editor view:
    image

4. Push your newly creating project to GitHub

Now, we will be switching gears back to GitHub Desktop to finish off this tutorial.

  • Open GitHub Desktop back up
  • You can use the dropdown menu at the top left to ensure you are on the correct project repository
  • There should be visible changes under the Changes section on the left-hand side. Note: New changes will appear even if you have made no changes to the game because meta data files are changed each time you open the game's editor.
  • Go ahead and fill out a git commit title and message and then select Commit to main
    image
  • Don't forget to push!~
    image

Important Note

If you are getting an error saying a file that will be uploaded is too large, it means that your .gitignore and .gitattributes are not located within the Unity project folder.
To fix this:

  • Use File explorer and navigate to the GitHub folder and drag the .gitignore and .gitattributes into the Unity project folder (should be titled with the name of your project).
  • Ensure the files are in the right location (should look similar to the image below)
    image
  • After moving these files, you should be able to commit just fine now.

Voila!

Congrats on creating your very first Unity repository! You should be able to start your first Unity project and be able to push your progress to GitHub.

Footnotes

  1. If you have any issues with this tutorial, feel free to message the ACMForge board on the ACM discord by pinging @GameDevBoard. Feel free to also contact @stephaniePocci (Commodore Jellyfish#5175) on Discord for any questions.

Read as TXT: /blog/813.txt