Project 1: Space Shooter

How to start a project in Unity

And linking it to a repository in GitHub

How to start a new project in Unity.

To start a new project in Unity, open the Unity Hub, go to the Projects tab and push the New project button. If you have multiple versions of Unity installed, choose the one you like to use from the top. Then choose which type of project you want to do, for my first project I will do a 2.5D shooter style game so I choose the 3D core project. Give it a name and select where to save it and click the Create project button.

While Unity starts the project I will head to GitHub, and start a new repository for my project. I usually match the name of my project with the name of the repository, so that it is easier to find later on.

Because I will not have anything that I want to keep a secret in my project I choose the public option. Which means that everyone can see everything that I’ve done for the project. The opposite is to make the repository private, then only the owner and those that have been given permission can access the repository.

Making a new repository in GitHub.

Last thing to select is to add a .gitignore file specifically for Unity. This file will list all the files and folders that are needed by the project, but can be omitted from the repository, because they can be reproduced by Unity when the project is run for the first time in another computer. Then all I have to do is to push the Create repository button and the repository has been created.

Depending on how you want to make a connection to the GitHub repository there are three options to choose from. The https and GitHub CLI options are less involved methods, whereas the SSH takes a bit more to set up, but works without problems once it is up and running. That is why I will be using that option, but all three are good.

Choosing the cloning method for my project.

When I have copied the SSH address it is time to head to the Git Bash and set my project to use Git. First I have to navigate to the project, then I have to initialize the project for Git, after that I have to add my remote repository for my project and check to see if the connection was done.

Initializing my project to use Git.

Commands used for Git were:

git init
git remote add origin "address to the remote repository"
git remote -v

Now that I have this done it is time to make my first pull from the repository to my project, the only file that should arrive is the .gitignore. The origin refers to the remote repository and the main refers to the branch into which I want to pull the .gitignore file. Once I have that, I can push my project to GitHub.

Making the first pull and push for my project.

The add command adds files and folders to the commit, with the option “.” it adds all the files and folders that had any changes. The command commit prepares everything for the push, the flag -m allows me to write a comment for my commit at the same line, otherwise it would open up the editor that I chose to use with Git for making the comment.

Lastly the command push sends it all to the repository. Since this was my first push I used the flag -u to add the remote to my upstream, I also specified to which repository and branch. Later on when I push from my main to the repository I can use only the push command without the origin and main, the same goes for pull.

Commands used were:

git pull origin main
git add .
git commit -m "Comment"
git push -u origin main

Now all I have to do is to refresh my GitHub repository page and see that my push succeeded.

Checking if the commit came through to GitHub repository.

--

--

--

Unity game developer in the making.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Kafka hands-on. Part I: development environment

Web Scraping Yelp with Beautiful Soup

6 Free HTML and CSS Online Learning Resources for Beginners

Loquacious — A Flutter ORM for Laravel developers (and more)

CS50x — Week 3

Bobbie Breckenridge https://t.co/2N59dK0UMA Thanks for Following Us on Twitter!

Deep dive into Spark Execution Model(with minimal words)

Integrating SonarQube in an Android Application via Docker 🐳

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Eero Saarinen

Eero Saarinen

Unity game developer in the making.

More from Medium

How to limit amount of ammo in a game

Showing that the UI element for ammo count works after every shot, and that the player cannot shoot after depleting all the ammo.

Starting to Feel Like a Real Video Game!

UI & Visual Design

How to Merge Unity Project Updates to Github Repository