FINISHING UP - How to make a Video Game in Unity (E10)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
look who's turning in so here is the last video in the how to make a video game series today we're going to be finishing our game by creating a credit screen a Welcome menu and making everything ready for the export phase let's get started so the first thing I want to do is to lead our level 2 that we created in a previous video and the reason for this is that we need to optimize the way that we create levels I see a lot of beginners simply duplicating their first level making a few changes and then repeating that process until they have enough levels and then of course makes sense and it's also what we're going to be doing but unless you think a bit about optimizing the process it makes it very difficult to go back and change settings so if we wanted to change some settings on the player we would have to do that on all the levels that is one of the reasons why we use prefabs so we can just take our player along with our game manager drag it down here our main camera our endpoint and our canvas and turn all of that into a prefab and I think these are all of the objects that we are realistically going to be changing but you could go nuts and change all the objects to prefabs this way we can easily update something and it will change on all of the levels now this is a bit of a hacky approach it's going to work fine for beginner games and that's also why we're going to be doing it here if you are creating a larger game you would either a make some kind of editor tool that makes it easier for you to create levels or be have all of your level data in a separate scene that you then load on top of your main scene if you want to learn more about that stuff I'll have some links in the description for now we can just go ahead and create a folder for all of our prefabs here let's select the canvas and game manager main camera obstacle and player and drag those in there and now we can save the scene and duplicate it as many times as we want I'm just going to duplicate it a few times here and you should of course go nuts now and create a bunch of interesting levels I'm just going to take the first one here and I'm going to remove some of the obstacles actually I'm going to remove all of these I'm going to take these two and move them forward a bit and space them out so this is going to be a really easy start level let's say that go into the second one and here I'm just going to remove about every second obstacle just to also make this a lot easier let's save that and then level three is going to be off full level now these are all really short but they're just for test purposes now we can go ahead and create a separate thing that is going to act as our end screen this theme will be loaded when we complete the last level in our case level 3 let's go file new scene or press control and let's create some UI so let's go and right click go you I knit select panel again the panel is just an image that fills our entire screen let's switch to 2d mode and hit F to focus on it let's remove the source image so we just get a blank color and let's make this non transparent it's also making a big grey we're going to call this panel credits and on top we'll create a UI element text again that's it f to focus on it and that makes it more room for this one I'm holding down alt to scale from the center it's also centered on the x and y let's change the text to something like thanks for playing and let's make the font size something around 50 I'm going to widen it a bit it's also going to define and change it to Roboto thin you can see now that if we maximize our game by hitting shift space oh it takes place the same size to change this we go to the canvas and change the UI scale mode to scale with screen size and drag it all the way to fit the height so now it scales up we can then take our text object and move it up let's rename it to something like thanks and then duplicate it by hitting ctrl D shift drag it down towards the center let's change the text to made by let's change the font size to something like 20 and change the font to Roboto medium again we can duplicate this move it down and you can just write your name I'm just going to write brackets change the font size to 50 again and define back to Roboto thin I think that looks pretty good let's also take these two text elements and move them up a bit and let's rename the first one to made by and the second one to practice finally we can create a button that will allow us to exit the game so I'm going to right click on the credits go UI and then button let's move this down a lot in the center let's scale it up I don't want it to be too big and then I'm going to show you some pretty cool button styling that I like to do I like to take the source image and select none' again so we get a flat colleague I like to leave this ad completely white then I'm going to add a new component and the component we want to add a shadow now this allows us to cast a hard shadow onto the background I'm going to select 0 on the X and negative 2 on the Y and then going to decrease the opacity this gives it kind of a cold simplistic modern look I'm also going to make the button even smaller then we can change the text of the button let's change the text to quit the font to Roboto regular and the font size to something around 20 we can maybe also make the color a bit lighter I think better so when you're satisfied with this all we need to do is hook up the button to some kind of script let's go to our credits and add one we can just go ahead and call it credits and let's open it up in Visual Studio now whenever we want to trigger some code using a button we need to make sure that the function we create is marked as public normally when we make a function we just write void then the name of the function in our case this would be something like quit and then some curly brackets but you can see that if we save this and go back into unity and then go and select our button we add an on click event this means that whenever our button is clicked it's going to notify what every object we put in here and we're going to put the credits object because that's where our script is sitting and that's the function we want to call we're going to go on your credits and then here you can see that there's no quick method so instead we go into visual studio and we mark it as public now when we save we should see that when we try and search for a function it appears let's select that and now every time we click this button it's quit button everything inside of these two curly brackets will happen and we only want something very simple we want to create the application so we go application dot quit and we're not going to be able to see this happening because unity won't actually quit the game when it's inside of unity only when you export it will it actually close down the window so we'll just throw a debug deadlock statement asphault let's say something like quit now if we play the game hover over and click our button you can see that the message quit appears in the console and it will do this every time we click that button of course when we export the game we'll only be able to click it once awesome now if you want you can really easily take the scene and make it into menu to do that we save it and this one is going to be called credits we then duplicate the credits scene and let's rename this to something like menu or welcome screen let's double click that and nothing changes but we are now indeed viewing the menu scene we can then change around some of these settings up here we can say welcome to and then remove brackets here and change the made by to some name for the game it's really popular to use some kind of twist on the void cube cube tastic oh that's cute I'm just going to go with cubes on yeahit's marathon and cube combined it's not good but it's the best I've got right now let's bump up the font size and maybe also change the color to kind of red just to keep things interesting let's drag down the welcome to a little bit let's drag up the button and we want to change some names so credits will be renamed to welcome things will be renamed to welcome to made by will be renamed to cubed on and the text of our button will be changed to start let's take all these objects and move them down a little bit let's also go to a welcome object before it was called credits and remove the credits script let's instead add another script called menu and in here of course we just want to create a single function that will start the game let's open it clean up and let's create again a public void and we can't call it start because that's a function already created by unity let's call it start game then we want to load the next scene so we'll be using unity engine dot scene management like we've done before and we want to write scene manager dot load scene and the scene we want to load is the next scene so we want to get the current scene are going scene manager get active scene then dot build index and then +1 if you're confused about what this does check out the last video let's save this going to unity now let's select our button you can see that the on click event is currently missing an object so let's drag in the welcome object let's go in the function and select menu start game now the last thing we need to do in order to string all this together let's go to file build settings and add all of our scenes into the build let's start by adding the menu and we want this to be on top because we want this to be the first scene that we see within the old level 1 level 2 then level 3 and finally the credits I'm also just going to take the two scripts here and drag them under the scripts folder and that should actually be it our game should be fully playable with the menu screen credits and several levels and if we're able to run this now we're actually ready for the export phase so let's hit play it's going to say welcome to cubes on let's select start to start the game you can see I'm in here on the first level that is really easy it's going to say level complete go to the next level that is just a tiny bit harder again level complete and here comes the third level and of course you can make these levels as challenging as you want and finally because we completed all the levels it's going to say thanks for playing and some credits and then we have the button quick here when we click that it's going to say quit and if this was an actual application it would down so that's pretty much it for this video and this series you made it all the way through congratulations on that and congratulations on making your first step as a game developer I decided to keep this video series pretty short so that most people would be able to complete it but I definitely want to make more beginner-friendly videos the new videos will just be on standard on subjects I'm going to begin by making a video on exporting your game to different platforms and we're going to use this as an example project so definitely subscribe and stay tuned for more so without further adieu thanks for watching and I will see you in the next video thanks of the awesome patreon supporters who donated in March and a special thanks to Derek Eames Kirk face llanera find James Calhoun and Jason the Tito if you want to support the channel and become a picture in yourself you would do so a patron account slash brackets thanks a lot guys
Info
Channel: Brackeys
Views: 814,768
Rating: undefined out of 5
Keywords: brackeys, unity, unity3d, easy, how, to, howto, learn, course, series, tutorial, tutorials, fix, tip, game, development, develop, games, programming, coding, basic, basics, C#, end screen, menu, details, finishing, up
Id: r5NWZoTSjWs
Channel Id: undefined
Length: 9min 35sec (575 seconds)
Published: Sun Apr 02 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.