How to Setup Github with Unity the Right Way

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if you're not yet using Version Control for your projects it's time to start do it so what's it good for well it provides a really clear history of changes for issue tracking enables experimentation through branching and ensures robust disaster recovery and release management let's think back for a moment I'm sure everyone has heard of the Toy Story 2 disaster during development of the second Toy Story movie someone accidentally deleted some files that practically removed 80% of the movie and this is where Version Control becomes useful even even outside of game development it's pretty much a way to store your files into a cloud so that data can be easily restored but its functionality doesn't stop there maybe you're working in a team and you need to effectively pass data along to each other well Version Control allows you to do that you make your change your team member pulls it in within seconds it's so easy and even more than that let's say you start working on something things are going well until they're not FS get deleted game gets destroyed you can simply scrap the branch and revert to an old version game saved and you're going to immediately be the hero of the team if you're not yet using Version Control for your projects now is the time to start today I'm going to give you guys the simplest way to set up Version Control for your games that I use whenever I start a new project let's begin the first thing that you're going to want to do is to create an account on GitHub then depending on whichever operating system you're running either Windows or Mac you'll want to install the GitHub desktop browser after you've opened the GitHub browser and you have logged in you can either create a repository through here but I'm going to do it inside of the web application so to create a new repository just go to the main GitHub page click new and create the repository name here feel free to add your own description if you want and set these privacy settings how you'd like you also want to add a get ignore specifically the unity one after that we can click create repository now back inside of our GitHub desktop app we can actually clone this repository now so at the top left we'll create add clone repository and find the one that you just created once you found the repository save it into a file or location that makes sense for [Music] you once you've done that you can click [Music] clone now if we navigate to the folder where the uh GitHub repository exists in we can actually see a git ignore here which is Created from the unity git ignore you can open it up in the notepad file just to look at but as you can see it's got a lot of preset data here which is essentially addressables or meta files that the git files can ignore now inside of the unity Hub we'll create a new project here and where we save it we'll save it in a location close to the original folder of the uh Repository after that you can hit create project and wait for it to boot up once Unity has booted up the first thing that we actually want to do is just close it because the main thing is just loading all the assets initially next what we want to do is we want to find inside of our folders where the uh Unity project is sitting so I've called it Version Control project and what I'll do here is all of the assets inside of it which belongs to Unity I'm actually just going to cut them out and I'm going to place them inside of the folder that contains our git project so enter once that's uh set up if we go back into GitHub you'll actually see a handful of new changes now these changes all belong to the unity project now thing is if we go into our Unity Hub here uh the new project that we just added will no longer be found which is fine so we'll just remove the project from the list and we'll add the project back in from the uh from the GitHub repository once we've done that we can immediately open up the project and now we can actually start working on the project itself now the first thing that we'll do is create a new Branch so the way that we do that is opening up GitHub we can commit the initial files here so bottom left create a summary that's the only thing that's required so we'll just say Unity setup you can add a description if you'd like to be a bit more thorough with exactly what you've changed but the main thing here is to commit to Main and at the top you want to push that up as well once that's been pushed up anyone who uh has access to this repository will be able to pull that in immediately now let's create a new Branch here and we'll call the branch UI [Music] setup now now we're in a completely new Branch based off of the main branch and we can start working inside of it so if we open up our Unity project again let's add in a random 2D object here and we just add in a circle and if we hit save here and open up the GitHub project we'll see we've got two new changes here and just to show you what this does exactly we can just say Circle Commit This and push it up again so for as long as we're on this Branch inside of our Unity project we'll have this circle but if we were to move back to the main branch reload the unity scene that circle is going to be gone so say we want to add the Sprite into the main game now we can open up the branches folder click on choose a branch to merge into main click UI setup and create a merge commit now if we just push that up again open up the unity scene once again reload it now we'll have the circle inside inside the main folder so it's honestly that simple so if we go back into UI setup now and say we start working on we'll add in a new Sprite here and this one will be another Circle but we'll make it red and we'll just change the position a little bit as well and once again we save the scene we'll have the new files here and if you decide you know what I actually kind of don't don't want the red circle anymore you can simply just discard the changes made to that scene and you again reload it gone so it's that simple guys so I hope this tutorial was useful for you guys like I said if you're not using Version Control it's extremely useful um and no matter what part of sort of software development you get into it's going to be a requirement so I hope you guys enjoyed this and I'll see you guys soon take care
Info
Channel: Garnet
Views: 4,852
Rating: undefined out of 5
Keywords: gamedev, game, development, game development, unity development, howto, how to use github, github with unity, how to use github with unity, unity github, unity github tutorial, github tutorial unity, unity, unity game, how to
Id: tTIlDb71t2s
Channel Id: undefined
Length: 7min 0sec (420 seconds)
Published: Tue Dec 12 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.