Unity Game Development For Beginners | Jack Donaldson | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Unity Game Development For Beginners

teacher avatar Jack Donaldson, Game Designer & Programmer

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

8 Lessons (59m)
    • 1. Class Overview

    • 2. Installing Unity & Custom Assets

    • 3. Setting Up Our Grid

    • 4. Setting Up Our Tiles & Prefabs

    • 5. Placement Functionality

    • 6. Win Conditions

    • 7. User Interface

    • 8. Game Build & Project Wrap Up

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

Learn To Make Your First Video Game!

This course aims to teach students with no experience how to create a PC Game! This class focuses on teaching students the basic principles of Unity & game development through hands-on tutorials. Using the free game engine Unity, students can learn how to make a fully functioning copy of the classic noughts & crosses game in under an hour.

Concepts Covered

By the end of the course students should have an understanding of the following concepts:

  • Unity & Visual Studio Installation
  • Navigating In Unity
  • Importing & running C# scripts
  • Steps Required For Game Creation
  • Importing Art Assets
  • Creating User Interfaces
  • How To Build/Export Your Game
  • Basic Game Design Principles

Is this beginner and kid-friendly?

This class is for students who are new to Unity and has no required knowledge, in regards to more experienced students I would suggest checking out my more in-depth courses on game development. The course has no adult themes and is suitable for all ages.

What You Will Need

  • 1-2 hours of free time (This is dependant on skill level and speed)
  • A modern PC / Mac capable of installing and running Unity (See specs here)
  • An internet connection to download Unity and Visual Studio

Meet Your Teacher

Teacher Profile Image

Jack Donaldson

Game Designer & Programmer


Hello, I'm Jack. I have been making games for the past 5 years using Unity and have a thorough knowledge of C#, C++, Python, HTML, PHP & Java. Please check out my courses on Game Development & Programming and tell me what you think!

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Class Overview: Hello, everyone. And thank you for checking out my unity gain development course for absolute beginners. Now, this course is specifically tailored for people knew the uni and have never tried game development before. Um, we start initially with a step by step basics installing uni on guy even include, uh, all the images and everything you need to talented and after Webber aren't or anything on music or anything like that. It all comes with it. And I have tried to jam this cause into under an hour. So it's nice and easy and quick so you can get a taste if you really enjoy game development over. It's something you want Teoh further look into or no, um, for the more in depth people, this probably not as relevant to you. I mean, you can check out my other courses for that, but yes, this is mainly for beginners. We initially start up by we're making a noughts and crosses star game. We initially set up power grid and then we worry about tiles and pre fabs, and I link all of the code we used. So you don't have toe. If you know into that you don't have to worry about typing all that out. Um, there isn't very much of it anyway on and then we work on the wing conditions on and lastly finish up with the U I and a finish level your and then we talk about building a game and wrapping up the project. So it's really Ah, nice simple taste of, um, to learn about unity. Three D, The free came engine will be using. All you need is an hour to a free time. Ah, computer and an Internet connection to download unity in visual studio at which, as I said, are all free eso please. Are you enjoying my course? And you make sure to follow and leave a review. Ah, it really does help. And if you have any questions going into the community section and leave a comment on, I'll try to get back to you as soon as possible. 2. Installing Unity & Custom Assets: Hello, everyone. And welcome to the first part off this course. So we're going to jump right in on open Internet, so weaken store unity. So the first thing I'm gonna do is get a Google and search for unity. Now, the first result should be you need a comp. This is the website where we can download the game engine that we're going to be using from , um, and straight around and get started. General takes to the plans and pricing page eso There are different, um, subscription models that you can pay. You only need to worry about them when you were making money from the game. So it is gonna go to the individual tab, go down a personal and click get started. Of course, it's one is free, and we should stay that it immediately starts trying to download. Um, it gives the option to whether a first time user returning user. Now, I'm just gonna click the Returning users section and it will want to be agreed to the terms we can click the download button. You can also choose Mac Os if you need that s O that will quickly download the unity hub set up file, which you can find that will should appear on if I run it. Um, we should say that we get the set up coming and you can just agree to that I'm in store in their quiet destination so forth. I've already gotten in stored, sir. I'm just going to open it right now. So if I search for uni have, um um it should ask you to crane account. If you don't have one already, they're free. So just signing. And once it's open, you should get a similar looking you wider This Obviously you won't have any projects, But, um, that shouldn't matter. So first things first, we're going to go to the install section and this is the different versions of unity because they release new ones for free every few months or so. I so did do so To install a virgin, you need just click the add button here and we'll ask you what version you want. Um, just generally speaking, always select the latest release. I'm going to be using 2019.2 point 11 F one eso if you want to make sure that you don't have any issues you can always select this. You may have just go down if you're watching this in the future. Um, but yet just select that click next. Obviously, I can't cause I've already got installed. But click next, and you get Alice for the different models to install. Um, if you don't already have visual Syrian starts like that, um, that will be used to edit a few of the tiny skirts we have to use. I meant I always so like to take clinics and Mac build support so that I can export the game to those platforms. So what you done that just click have done, and it will bring it up here and starting strolling it. I already have it installed, so I'm not going to do that. But once it is ready to go, you'll see that there's no longer a bar here. Um, and what you should be on do is go to the project's tab now and you'll say that we can crane your project now for me. What? I have multiple versions and sort. I have to click this arrow to the right here and select the version I want. So I obviously want the 2019.2 point 11 F one build on. And I'm just going to select that. You could just get the new button right here and it wouldn't matter. Eso obviously we're going to be doing noughts and crosses, so that would be a two D game, and I'm just going to give it and a appropriate name. I always like to stop mind with project. I'm going. Just call it Project North's and Crosses, and I'm just going to select an appropriate location for it. It is good to, um, once you've got a photo, um, to just create a unique files voter inside of it. I'm because this will make a lot of different files around arms. Like like your desktop or anything. I make sure to put in the sub for a So I'm just gonna select that and I'm going to hear to create eso. This may take a little minute. Um, we'll see how we go on, and it's just going to prepare the uhm union. Obviously, I've got in a firewall. I'm just going all the access. Um, because it does need the internet for certain pages Now. Um, whilst I'm waiting for this to load. Um, here is a link on the screen which will take you to, um, a folder that you can download. Ah, And in this, it will contain the course materials back, which just has a few different images that we're gonna be using throughout. Like on the cross images is the north image. And, um, just a background feel color. So once you've downloaded that far, um, just bring it up here. It should be a course materials pack. Is it fall? Um, you should go into your assets window here in usually just right. Click and click Show and explorer. Now, what this will do is bring up your noughts and crosses folder, which is where all of your projects follows. The story now, in this assets follow thistle is what this is representing down here. You can see it seems one we're just going to drag in the course materials pack zip, Father, we downloaded, uh, like so. So once you go to that, you are l to download that I'm and I'm just going to click extract. Um, here and it would just create our course materials pack fora. And inside this we just have, um, across snorts and our white feel color Eso This should all work as expected. And you should be good to go. Now if you click on unity now, okay. And you should now see the course materials pack photo appearing in the assets, brother, and you should be able to see that three different images here that we can use. So that means you're good to go on and you've got unity installed properly. 3. Setting Up Our Grid: Okay, so now I'm quickly going to be explaining how unity works. Um, and if you make sure you follow the previous video and install the course materials pack as well from the link provided eso here you have your scenes. So these kind of like your levels were lonely. Stick with one for the moment. Um, and to start off with, we're going to go to a scene photo. Um, and we're going to go file new sing to this. Logan, you seen up. And if we go far save, it'll ask us to save the new scene, and we'll just call this one main level. This won't matter too much. And you say the PC and we'll just delayed the old sample. See, notice that the lake cave, but you can always right click and delete it as well. Eso make sure your constantly saving the scene because any changes we make will need to be saved. Otherwise, if you don't do that, they may be lost, which we don't want eso. Now that we've done that, we're going to set up our, um, camera. So we're just selected on first things First, I'm gonna change the background color eso I have a few different possible color options. I'm going to just stick with this one I've found earlier. You can use it if you want or select another one. So to change color, I'm just going to click the background button here on. I'm just gonna type in the Hexi decimal color to be a yellow, as you can see here. So now in the game view, which is what the players is when they're playing again, you can see that it's looking probably. There is also the scene view which is a bit more hands on, so you can scroll in that. Make sure if you're not already you're in this, you've got two days selected. Otherwise it'll be in three D mode, which we're not going to be using. ESO you can hold the middle mass button or right click to pen up, down, left and right you consume with this girl Will, um, and you can also select things with left mouse. But you can also select from different objects by selecting them in the hierarchy here. So that's called the hierarchy. I'm in your survey inspector to the right. When you have something selected. It will show more details about it that you can edit eso first things first. What we're going to do is right, Click e and we're going to go to two D object and select a Sprite s O. This is our image part. So where does can name house object Grid part? I am this gonna be the first section off grid. Ah, And now the transform component here. This tells us where the object is positioned in the world using X y and Z coordinates on. We can move it around using for the position or move tour here. Now, I'm just gonna set its position to start off with it. You're 00 And now, obviously, we can't see anything right now, so we need to select a sprite or an image. So do this. We're going to go Sprite, render a component and press this little circle here, and we should see that we have the white feel color option from our course materials packed . So we're just gonna select that. And as you can see, um, the images here. So we're just gonna get a rectal, um, And this director, we get to by selecting pressing up here. And we also have the rotation and scale tool which we can use later s. So what we going to do now is we're going to set its scale with to be 0.1. Ah, and this is you can adjust, you know, in your game view to see how. Why do you want your grid parts to be? I think this looks pretty reasonable. Eso then what we're gonna do is move it to left to right. Now I can hold control and it'll snap it to the nearest home One number or I can no end or do decimals. I'm gonna hold control and actually type it in and do negative positive 1.5, um so that we have even spacing between them. You'll see how that turns out in a minute. Now, I'm also going to We could also use a scale tool and, um, changed the height. So I'm just gonna change it. Still, the height equal to two, as you can see here. Or you can just type it in on. And that's looking quite good. Eso now Lincoln do It's just copy this or duplicated um and then just move. Um, this second object we've made to be a negative 1.5. So this and even space between them and agency, That's how two lines going straight down the center to form Al crit. So we can just rename these grid parts to be vertical grid parts. Um, and that looks all well and good. Now, I'm just going to duplicate one of these again and name. It's one horizontal cred pot and where going to rotate it so we can use the rotate tool on hold control, which will snap it two angles, um, and just change it. So it's equal to negative 90 or positive 90? It doesn't really matter. They're the same thing. Ah, and we're just going to center it. So the X equal to zero, and we're just going to move it up so that the why is at 1.5, I believe, is what we want here. Um, And now, as you could say, Forget about game view. It's looking good. And we're just going to copy another horizontal grid part and put it, um, at negative 1.5. So if we look and I gave you now, it's nice and even on all the sides and thes squares looking good. So we've got our grid laid out, and just to finish it off, I'm just going to put this all in one object so we can move him easily together. Soda juice. I'm gonna right click in the, um, hierarchy and click create empty. That is just basically an invisible object. I'm just gonna name this object grid, and I'm gonna reset the transform. 2000 are, as you can see here. And I'm just going to drag all the different good parts in to the grid. So now when we moved the grid, you can see that all the good parts are moving with it. This just makes it easier to organize and lay it out later on. So now that we could out crude, set it up and hopefully you haven't. All right. Quick and easy understanding of how the unity, uh, editor is laid out 4. Setting Up Our Tiles & Prefabs: Hello, everyone and welcome back. So now we're going to be setting up the initial stages s so that we can later implement them. So we're just going to be implementing the things we can click on and set up our prefects. So explain what that means. A bit later on up for things. First, we're going to go into a grid component and we're gonna right click and go create new to the object Sprite and just make sure it's dragged onto the good component. Now I'm just going to call this one tile, and I'm gonna race at the position to be 000 So I just did that well, by right clicking the transforming, selecting reset. Now again, clicking this circle and setting the image to be in the white fill of color. And as you can see, we've got this year. So we're gonna need nine of these two being each of the different squares and this is what they're going to click on now. Obviously, this is gonna be invisible in the actual game, or you can change it to a difference price if you want to. But just for visual looks, I'm just gonna change it too bright red so that you can see it. And later on, we will turn off the sprite. Ren Drissi can't see it. It'll so that doesn't matter anyway. So just be color. That's easy to see. Um and I'm just going to change the scale to be 0.65 because that fits in perfectly with squares. And now I'm just going to duplicate these and whole control and chain. Put them in the right spots at using the position or moved toe over here if you have that selected, uh, so I'm just gonna quickly do that, and we're almost done eight and nine. So now that we got all of those, I'm just going to, uh, order the tiles in the right order set from one being top left to nine. Being bottom right. I'm just going to make sure that they are named properly. Uh, so that's we can using Cone. You won't get any confusing at scenarios where they Arntz I was very tall. That's not tall. Wants a tall one should be this one. So, as you can say, I'm selecting them and you can see what selected by where the movement Will is so you can see that should be down there. So I've got ta 123 and four. It's We need to find its force there. Five, is there six is there 789 So I'll just name them quickly A Z You can see it because naming that just helps. Um and they need to be in this dissing daughter so you can't have nine being the top left, for example, because you will get issues on Also, just to rearrange them, you can just drag them in the hierarchy so I could move seven above it and make sure if you accidentally click on, like, drag on top of something that becomes a child. We don't want that, Uh, so we need to make sure that they're all separate, but, um, in the right order in the hierarchy. So now that I've got that, you can just quickly go through 123456789 And there are working properly. Eso Now that we've done that, we need to make a prefect. So to do this, we're gonna go to our assets here and right click and creating new photo my just gonna call this one pre fabs nice and simple. You can name really whatever you want. Ah, and this we're going to use to make copies off our tight leg of our north and crosses that are gonna be placed in the world. Eso to do this, we're going to create a new two d objects bright, and we'll just call this one across. Um, nice and simple, uh, reset the transform to be 000 and against, like, circle. But this time we're going to change the sprite to be off the cross. Ah, and now I'm going to try and adjust the scale here. So that's fitting. Well, within the borders, obviously 0.65 eyes still too big. So maybe 0.45 might be a better option. And again, that seems to be working. That looks pretty good. Now I'm just going to remove this annoying red, so I'm just going to hold shift and select all the tiles. You can edit everything once which is really handy and just unchecked this bright raindrop so that that isn't working anymore. And you'll say that if we go into the game now, we couldn't ring those horrible red boxes. But you can always I just turn them on and so that I can see him see where the different tars are. But otherwise you don't actually need them. It's now we got across bright. I'm just going to duplicate it and make a similar 1/4 ate my not, um, and selected to be the North Sprite. So obviously that snort Sprite is looking, uh, quite good as well. Um, and making sure that these both enabled with this bright renderers. Now that we've done that, what we're gonna do is drag them down into our prefab sorta so that makes a copy of them. Because we're gonna be support. Now we can actually drag in lots of different copies of these, um, different noughts and crosses, which is really what we're gonna be doing in the code anyway, so that the game works properly. Eso Now that we've done that, um, that's all You can move on to the next video 5. Placement Functionality: Okay, now we're going to start with Al first, we're gonna hopefully implement placing on our tiles. So the way we're gonna do this is good. What Assets Photo. And we're gonna create a new folder inside of this, and this one's gonna be called scripts. Now, um, I first want to reiterate that this isn't a full programming course. Um, I do have others available if you would like to go check those out. But, um, I'm just going to be going through the code and writing it, and I'll try to explain as much as I can't. But really, you need to know, um, a little bit of you need if you want to try and understand what's happening. Um, you should really check out some my other programming tutorials before this, Bart, Um, I will be giving you a link to download all the scripts and copy and paste them. If you don't want to worry about that. And if you just because this is a beginner's course, that's obviously an easy way to do it. So you can I will send a pace being pace. Been link. You can probably see it on the screen now um and you can go to that and just copy and paste into the script so you don't have to bother typing at all that if you don't want to do that . Um, but otherwise, if you do want to learn programming, this is a beginner's course, so we won't be covering that too heavily. Okay, so what we're going to do now is right. Click in the script, thought I click create and C Sharps Group. Now it is gonna name this one game controller with a capital G in a capital C. So once you've done this, you should have a far that's created. You can just double click this opener and a load up visual studio which you would have in store in the first video with, um, a unity. If you haven't done that already, you can just go back and watch that and see how we did that. So, once that's open, you should see a screen somewhat similar to this, or you may be using a newer version of visual studio. So I'm just going to remove the start code here. Ah, and we're just gonna focus on the update loop. Eso what? We're going to start off with is just a simple if statement that checks. If, um if the player is pressing down a k So to do this, we're going to say if import dog get k down on Madonna, parsing keiko dot Mancera which the primary mouths or the left mouse. So you can always change that. If you want to be right Mouse, middle mess. Have you safe it by attending into mass one or two eso essentially Ah, this checks if we ah pressing the mess at because this only returns true during one frame. So now we're gonna just, uh, start off by, um, giving in el Rey very well, So we're gonna declare it with the type rain, but it's gonna court rang, and it's gonna equally camera domaine dot screen point to rank, and we're just gonna pass in the input mouth position now if what I said was just confusing All this is doing is it setting out variable rank equal to its converting the position of the mouse from you? I coordinates into world coordinates, so we can then essentially fire a laser from the camera to the location of the mass. Um in the world space for the two days space. And basically it will return anything that it hits. If you can kind of imagine it like that, that tends to help. Now what we're gonna say is we're gonna this raid cast hit two D. Um, hit variable is going to hold the results off this laser firing, and it's gonna be equal to physics to date dot Recast. And what is gonna pause in the origin or the ray ah n vector to 0.0 as the direction nice and simple. And it is gonna say, if hit Doc collider is not equaled and now, then this means we have hit something. And for now, we're gonna do is just debug dot log a message that says we hit something. Um, just to check it all works. Ah, and that's the final code for now. So what we're going to do is open up unity now and we're just going to go to our grid object here, and we're going to select all of the tiles by holding shift and click add component. Now we're gonna add the box collider to day component to them, eh? So what? This does is it just means that they can be collided with by the physics system and in this case, hit by the recast. So you now should see the green outlines off the boxes if they're in the right position and what we're gonna do is gonna camera now and we're gonna add a component in this is gonna be our script called Game Control. He can also drag it in if you wanted to do it that way. So now if we hit plane and we never get to the console here, when we actually touch the tiles, hope we click over here in the yellow will see nothing's apart happening. We're not getting any messages, But when we actually if we click the white willing anything. But if we click, any of the tiles were getting a wonderful message here, so this is exactly what we have Bean looking for. So next thing we're going to be doing is quite simple. Where is going to go back to our script and we're going to make sure we're going to actually test what tall number it is. All right, essentially. So the way that we're going to do this is we're going to festival. Ah, set up the top here and the update function. We're gonna do a variable, and this is gonna be a bullion Sutro false. And it's just going to determine whether we clicked a tall So what is gonna call it Click tile and it's gonna default. False. Ah, And in this if hit dot colliders nautical know what is going to say inside of it if hit doc , Kaleida dot name don't contains at tile, But then we're just going to say click tile. It was true. And we're going to, um and then be over to up the top here will have another variable. And we're just gonna call this one selected tile, and we're gonna day for you to know. But if we hit after our weather is going to say, selected tall eyes able to hit doc collided off game objects. So nice and simple there m weekend. Just, uh, gets, um, read off. These lost to the state bubble line here and are Just name that. Obviously, if you no interest in this, um, the final script will be ready to go on pace. Been so essentially what? This is doing is we're just now able to check it for here to proper tile, in case we had any other objects with collisions. And outside of all of this, what we're then going through is essentially say we're gonna spawn on your game. Object. So to do this up, the top of we're going to do is have to public variables, public game objects. And this one's going to be a, um, North prefab. And what's gonna have public game object Circle Prefect outside Cross prefab. So now, um, we have access to the objects that we made earlier on on and then we can simply instance he ate one of those. So the way what we're gonna do this eyes will have a public Oh, we don't need a public. So I will just have a ah game object. And this will be current players turn prefab and it won't be equal Anything but just in l update function would just say it's equal. Teoh the North Prefect for now we'll deal with that later. Eso you can see it's looking like this, um and inside of this at the end, what is going to say if click tile then we'll say game objects dot instead see eight and will say selected. Uh oh. What was the quote? Can't play turned prefab and would just give it to a local variables That would say, what new? Ah, Priefer could be equal to that. So this essentially check saying like if we, um have click something, then we're going to create a new copy off the north or the cross prefab, and we're just going to simply say, new prefab dot transformed opposition is equal to ah, selected tile start transformed opposition and that should be all working. Sophie, Open of unity. Now what we're going to be doing is, if we go to our main camera here, we should see we have the norm. The cross prefab. If we go to our project assets and pre Fabs folder always looked the main camera again. We can then just drag in across and not prevail. If we don't have those will get errors. So if we hit play now, what we should see is when we click, our tiles were actually spawning are north prefects, and it's working as expected. So now all we need to do is make it so we can't click the same title twice. Somewhat to have done that, All we're going to say is you know, if someone just going to say destroy, um selected tile and that means that we can't click on it again Nice and simple. So all we're going to do now is just have a change. Turn function. So outside of this, what is going to avoid? Change? Turn. Um, and all this going to say if calm play turns Priefer ah is equal to know prefab. Then we will say, Can't play turn prefab equal to cross brave else Comp Laters. Prefab is equally not prefab nice and simple, and this just means it will alternate between players. So because at the end of this we'll just have out changed turn function being code. So if we open up union now, we can go and we should be at a play and we can find that it's currently not alternating properly. So why is that? It can play 10. Prophet's include no prefab. Um maybe what we'll do is safe The names of the same just for the sake of it, Check. That's not the issue. When we play okay. Is he sort of? If it's equal to the North prefab, then we'll changes to the cross. One, if otherwise would change to the north one. I'll just be back in a second. Okay? So this is a very simple fix. The issue was that Ah, we would, forcing it to be the North proof of every single frame. So to fix that up the top here, But it's gonna set it equal to the North. Uh, we're just going to do out stop function. So I would avoid start and we'll say current players brief as equal with no prefab because what was happening before Sorry was that this update is called every frame. And it was setting it every single frame rather than just once, which was all we needed. Now forget play. We can see that it is alternating, which is exactly what we want. So next year we will start working on some wind conditions 6. Win Conditions: Hello, Ron. So now what we're going to be doing in this episode is dealing with the wing conditions, because at the moment you can see that we ah, alternating but away. I can't tell if someone's one. For example, the three in a row here should mean that X has won. So the way that we're going to do that is pretty simple. So again, if you want to skip the script, then you just proceed to this link here. Otherwise we will open back up, out visual studio. The two out gang control the script. So up the top here, what we're going to do is have a not necessarily public will just have a int array. And we're just going to call this one placements and then that's gonna be equal to a new interim with a size of nine. So nice and simple, and to start off with Ah, we will just go for each Ah, 00 sorry. I'll say a full lips are four. And then double tap tap on will say is less than placements. Don't length and we would just save placements. I is equal to zero. So what? This is going to do is ah, This will go through this world, loop through the different elements in the placement array and set each 1 to 0. And what we're going to say is that, um, as your equals, um placed one equals noughts and two equals crosses, which is relatively simple. And we're just gonna have a public into you, which will determine the current players. Ah, it's like what player we have selected, which will just make easier. And then if we scroll down to a change turn here, we're just going to make it so that I can't play up. ATF across is equal to and for not is a good one. Air mortars defaulted to zero to begin with. Just check knots. One crosses to Yes, so that would work properly. Ah, And now what we can do is just get rid of that tune eating it up. Ah, we can quite easily. Uh, just when we're clicking a tile, we need to know what's time number? We've gotten eso to do this. What we're going to say is in this click tile here, where just going to go through in strip the tall name here, so we'll say string. Ah, name is equal to select selected tile dot name and we were saying name dot Replace a mosaic tile. Uh, and we'll just replace it with nothing And what we should find that Liza's with numbers. So will say int num equals ah, name. Don't sorry it was. It's equal to end dots pass name. So what this is trying to do is it's getting the tar name, which is eagled electile one tile to tell three. Let's get replacing the tile part of it with nothing. So what's left is just 123 and then it's converting it into an integer. And all we have to say here is placements at the location. Number is equal to selected or current player, which is nice and easy. And if all we had to do was just make this a public array and we hop on into unity, what we should be out of C is its appearing in the inspector here. Um, and also the can't play here. It's iterating very, very quickly. Eso to fix that, all we need to do is go into a script and change turn. It's actually getting called. Um, every frame where it should only actually be called. When we have the we've clicked a tile eso we just needed to fix up And now we hit play we consider the current player is working properly. We set that one in their placements We've got our ray with There are so if I click in the first tile here, we should say that we were getting a slight error here. Now why is that so? Free antique play and all we have to do is we're gonna go to here and we're just going to debug dot Look, what name is equal to at this point and if we open up unity and we hit play names equal to tall one. So obviously this replacement, what we needed to do was say names where we were just Ah, we weren't actually setting the very bored to be the replace version where tire wasn't in it. So now if we open immunity that we should say that if we had playing, it's working properly and we're not getting an arrow, So why are we so as you can see here, the different placement array is getting it's ah sections set, probably Ah, and we've gotten an error here because when you click on the night tall, it's actually going to the There's No nine elements in the right is because it starts from zero. So to fix this, what we're gonna do is we're just going to say placements numb minus one, and that should work properly. And now we were getting a slight issue. Where can't player was not being set? Probably. So I'll just make sure you said it in the start function here because it was being set to zero, which was causing an issue. Uh, and now if we go into one him now, we should say that we're actually starting on one Nazi era, and you can see that it's alternating properly and we're not getting any errors. So now what we can do with this array is have a win condition function, so this is very simple. It would just check for patterns so it will be a ball. So we're turned out the truth Both, um, and we will say, check, win and we will say, um, we will pass in the end off the place to check, player to check and so play to check in this case will be equal to other one or two one being not into being crosses. And we'll simply do a bunch of if statements will say placements zero. And also it is equal to play. It's a check and placements, one is equal to play to check and placements two is a good player to check. Then we will return true and at the end of this will return falls. So essentially, this is just checking up. This needs to be double equals that why essentially, this is checking the I'll show you. It's checking here, here and here. And if they're both equal to other north across is then it will return true for them winning. And now we're just quickly do some will just display if players one. So at the end of this change turn, Um we will say if check win play one is true then would just give up the log I will say not one else. Ah, if check win and will say to then was a debug log crosses one. It's now gone, TNT. We should find that we haven't got all of the cases in the moment, but if Ah, we played it properly and we found that we click. We knots will have three across here. We will get a message to say North Point. And if we did the same thing with crosses, we will say crosses one. So now all I'm going to do is just quickly hard code in all of the different possible values. So the three different across is and the three different downs plus the two diagonals. So to do this, it's quite simple out. Just, for example, for the next rail, just say +34 and five. And for the bottom row, I will say 67 and eight. Nice and easy. Ah, and I'm just going to do the same thing for down and up according to their location in the array. Okay, So quickly done that. So But the down and the diagonal that didn't take you long, but you can always copy it from the pace. Been source. Uh, sorry. So now if we play, we should see that if we do down strips if we sorry for diagonal can see notes one so that work properly on. And if we did down stress, for example, see notes. One eso These are all working properly. Now we need to do is just display that message and we'll do that in the next episode. 7. User Interface: Okay, Run. So we're gonna quickly add in some final you elements. So, uh, some text saying or plays attorneys and then if someone wins some texts as well. So to do this, we're gonna right clicking out you are here, right? Clicking on hierarchies let you wife and go to a text. Tex Mex pro Now Windows appeared. I just need to click import text, much pro essentials. Um, and you'll get some bars here. You can use the default. You anyone? Um, but I'll prefer text message pro, which should come pre installed. So for Goto, I've seen view here, and I'm just gonna press f Ah, here. And we can see we'll find out text and I just going to wrecked mode and I'm gonna drag it into the top left on expended up a bit and for exact all we're gonna put in here is current turn and a space, and we will say, North's on if we want We could do bold here so I could save spec slash b like, hey html and you see it's north says current turned. So this is getting needs to be a bit away from the edge. We just fixing all adjusted. So and you can see that it seems to be working. Probably I could do it all in bold you honestly can do it. How you see fit eso. Now I've done that. I'm just gonna drag these anchor points to be in the top left, like mine. So one in the far top left and then the other one at the corner of where you've got it stretched out to bay. And you can also take auto size. If you want to do that, I'm just going to make sure do it. You can set a minimum size in a maximum. And what this means of difference grain sizes. It will adjust the size of the text. So that fits instead of having just one size I had that may get smaller for bigger screens and so forth. So I'm just gonna make sure to leave that on my second name. This one current player text nice and easy on with the canvas here, I'm just going to click on it and change us scale mode to scale with screen size and set it to be 12 80 by 7 20 This is just used for multiple resolutions, and I find that these values work the best for different screen sizes. Uh, because otherwise you have some issues with scaling and next in the canvas or we're going to do is just open up our game controller script here again. Ah, and you can get the last section of this online if you want. And I'm just going to, um, so you can get it off pace been now and copy and paste it in, or you can follow through with me. There isn't much in this one. That's all we're going to say is public. Um, at t m. I need to import text. Best prop the top e Sorry, which is like a library. So infusing tm pro and we'll say public Tim pro you going? And we'll just call this one kind player fixed and simply enough in the start function will say Come play text or texts is equal to a current player, Colon, and then we'll be back slash and which means new line. And then I'll do bold. And then I will say, um, we'll have to get the string of the players also strength current. Oh, what's a player name defaults to North's um, and I'll say if current player is equal to two, will save player. Name is equal to crosses. And I will just add the play name to this string we're going to display and just close off the poll tax. So and I need to make sure they can play it where we set it to the first person is above it . Otherwise we'll have issues. And essentially, what this is doing is it's getting the complaining so with defaulting it north. But if where on crosses would you said that? I m we're changing the text to be equal to can't play out plus a new line plus bold plus the player's name. And then we're ending the bolt here and I'll just scroll down to the ah change turn function, and at the bottom of this artist paste that code into it automatically updates it. So now if we open up unity, what we should say is that we have a calm Playtex down here which we can just drag in nice and easily, and if we play, we should say, can't play it notes. Off camp iron crosses north crosses as such and not. And it's working properly. No. Oh, we have to do is do a windscreen and I'll add one more lose condition, which is when there's no tiles left. So to do this final windscreen, I'm just going to have it so that we have a u Y, uh, panel here and it's going good with seen view. And I'm just going to set at the source image to be white, full color, and I'm just going to actually make it so that the color is the same as my background here , um, and I will change the transparency to be full. So did just change call. You just click on the color here and inside this panel. I'm just going to right click on you. I text much pro and in the right center of it, I'm just gonna track it so it fills this whole thing up, and then I'm gonna make sure that the anchor points are right on the edge is as well both for the panel and the text and said the text to be scented and give a nice big font size bold and it would say something along lines off crosses winds, if you want that. So that's kind of what I'm going for. Um, and that should work properly. So that's gonna be my windscreen. If I wanted a bit high, I could do do something like that, which I think looks quite good. Wind techs is what I'm gonna call it. And again, if you want to copy this next bit off paceman, you can. What we're gonna do is go open visual studio and up the top here, we're gonna have a public, uh, text mish pro. You going? And we're just gonna actually, Yes. Sorry. Text much. Per you're going? And we're going to call this win text and what's gonna have a public game object win panel and then stop function. We're going to say when panel dot said active false. And that should work probably. And we're going to do is in our check win. We will copy and paste out name code, uh, from the ah change, turn function. And when we're checking the wind, which we say not one or we have to do is just paste this in. Ah, it's also, you know, or we're going to do. Is we'll say, uh win panel Dot said Active True and will say when text don't text is equal to Ah, in this case, it'll be north one. And in this one it will be a cross is one nice and easy and now always should have to do is open a beauty good to the main camera and will say, You gotta win text and win panel here. We can just drag them in accordingly and you can see it's working. If we win the game, we get No, it's one which is what we want And if crosses winds, we just do the same thing. No, no, it's one that Oops. Okay, let me try again. They're there and crosses one. There we go. It's working public now. I'm just gonna make it. So we have a bun, we compress that restarts it. So in this panel ago, you are of bottom Tex Mex pro, and I'll just drag it to be, uh oh, drag it So it's underneath the crosses winds button here, and I'll make sure that the anchor points along the edges so that it scales properly and I can go here. It's like the text, and I'll just say Restart and only Bolden. Bit of italics, maybe. No. Tallix and I can change your eyes bright to be the fill color and just said its transparency to be a bit different. Okay, move. Just go to a text and we can set the color to be white if you want that. And maybe I might make my bottom a bit darker, so it's easier to see um, and he congest the animation colors Here is, Well, eso game view. That's what it's gonna look like. Maybe I might have the font size of beer. Um, and that should be all quit. So what I'm going to do is just open up visual studio again quickly. Ah, and have a public void. Um, but in restart button pressed and all this is going to say application dot load level. Sorry. No. What? We've got to first used the new library sort of up to help and say using in t engine dot Seen management nice and easy and was application was application was a scene manager load Seen Emma's face where loading seen manager dot get active scene. So essentially, what this is doing is it's just restarting the level. Ah, nice and simple. And we need to get the name of the currency. So that's what Probably if we go into unity now. Ah, we can just go to a button. Let's go down. What's his own click drag in the main camera. Click here, Select the gang controller and quick re stop Unimpressed. So now if we hit play and a player winds, we can just press the restart button and we're back to the start, which is what we want. So, uh, that's it. Now, if you want, you could change the panel here to be a bit more transparent. It's really up to you how you wanted to it. Something like that. My look, look sorry. Something so 1 73 my local, right? And then you can see where you went wrong. Once you're done. So I could go Bam, bam, bam! And you can see. But currently you can still place so I can fix that later on. Ah, much. That's why I've kept it transparent. Eso you can't see that, But other than that, that's the your wife in out and in the next year will be building your game 8. Game Build & Project Wrap Up: Okay, Run. So that's our noughts and crosses game done For now, you can say that we can switch between players are and so forth, and the game works properly on as expected. So now all we have to do is build the game. So you consented. People s o do this. We go file, build settings on. You need to make sure that you add open cents for this level. Otherwise you'll get an error and you can select the different target problem. See if Mac OS and Knicks aren't appearing. That's because in the first video you didn't install the required libraries. I like to set the architecture that Times 86 underscores 64 so that it works for both platforms. Um, and then all you have to do is you wait for you need to load for a second. It appears to a broken visual studio. For some reason, I and then you see the bill button and then you select your locations off. I have a fields photo, and I just select that you should say that you need will build your game. The bigger it is, the longer it will take. But of course, you can use their different platforms that you supports as well. If you want to do that, Ah, and once it's done and you should see that it opens up the follow with the ink saint, which you can then run and you will load your game So you can see here that, um if I was having in north across his game, it's working properly. Um, and as expected, So Ah, that's this course done for now, if you want, you can always try to expand this. It is for beginners, and, um, it is a bit more difficult to do that you can check out my other courses. Please make sure trying to follow me if you enjoyed it or leave your review. Um, you can always try to explain this. You could add animations, music menus, those kind of things which we haven't covered in this short course. And those sort of ideas can work properly as well. Another thing when you're exporting it, if you go to edit in project settings, there's a lot of different values and that sort of thing you can set in here. I'm like your icon and your company name and product name. Whether you want the men used to appear in that Clinton. So you can fiddle with that if you want to as well. Um, And I hope you enjoyed this course. Thank you.