Unity 3D Masterclass - Learn Game Development Basics | Domen Rajterič | Skillshare

Playback Speed

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

Unity 3D Masterclass - Learn Game Development Basics

teacher avatar Domen Rajterič, Software & Game Developer

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

25 Lessons (1h 41m)
    • 1. Class Introduction

    • 2. [1] Player and Terrain

    • 3. [1] Camera Settings

    • 4. [1] Player - Movement

    • 5. [1] Player - Shooting

    • 6. [1] Level 1

    • 7. [1] Functionality of the Platforms

    • 8. [1] Adding Time Limit

    • 9. [1] Adding Time Bonus

    • 10. [2] First Platform and Player

    • 11. [2] 2D Movement of the Player

    • 12. [2] Cinemachine

    • 13. [2] Trampoline

    • 14. [2] Self Destroying Platforms

    • 15. [2] Detector

    • 16. [2] Water - Buoyancy Effector

    • 17. [2] Platform Effector 2D

    • 18. [2] Lava

    • 19. [2] Finish Pad

    • 20. [2] Level Manager UI

    • 21. [2] Level Manager

    • 22. [3] Ground, Light and Player Settings

    • 23. [3] Player Movement

    • 24. [3] Camera Settings - Cinemachine

    • 25. [3] Animations

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

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

Would you like to learn game development fundamentals, but you don't know where to start?

My name is Domen, I'm game developer and this is my new class on game development with Unity.

In this course I would like to cover three (3) main genres of games:


In the first chapter, we will create simple FPS game with many useful mechanics that you can use in development of your game.

Number of lectures in this chapter: 8


In the second chapter, we will develop mini platformer game with many obstacles and cool mechanics.

Number of lectures in this chapter: 12


In the third chapter, we will discover how to make fully operating third person controller with animations!

Number of lectures in this chapter: 4

- - - - -

Entire class is divided on 3 main chapters with 24 lectures combined, also available as separate classes, if you would prefer to discover only specific chapter of this class.

We will learn all about Unity engine. We will learn about programming fundamentals and much more ...

At the end of each chapter, you will have class project that will help you build up your game development skills.

And if you have any problems during the class, I'm always here to help! :)

Join our discord server to share your work and connect with community!

So, if you're willing to discover the world of game development, welcome in my class! If you like this class, please leave a review, it really helps me and it is very appreciated. :)

(Software required to participate in this class: Unity3D and Visual Studio, both available for FREE)

Meet Your Teacher

Teacher Profile Image

Domen Rajterič

Software & Game Developer


Class Ratings

Expectations Met?
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%
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 Introduction: Would you like to learn game development fundamentals, but you don't know where to start. My name is Dominique, I'm game developer and this is my new class on game development with unity. In this course, I would like to cover three main genres of games. Chapter 1, first-person shooter. In the first chapter, we will create simple FPS game with many useful mechanics that you can use in development of your game. Chapter 2, platformer. In the second chapter, we'll develop mini platformer game with many obstacles and cool Mechanics. Chapter three, person controller. In the third chapter, we'll discover how to make fully operating third person controller with animations, entire class is divided on three main chapters with 24 lectures combined. We will learn all about Unity engine. We will learn about programming fundamentals and much more. At the end of each chapter, you will have class project that will help you build up your game development skills. And if you have any problems during the class, I'm here to help. So if you are willing to discover the world of game development, welcome in my class. 2. [1] Player and Terrain: Hi, welcome to the first chapter of my class. I appreciate that you have chosen my course and I believe that we learn something new today. I will try to cover as many aspects of game development as possible and to explain everything that we do in details. I plan to create a simple first-person shooter mini game with one level that we are going to build together. After that, for the class project, you will create a second level or more with knowledge that you have gained in this class. So let's get started. First, we need to launch Unity Hub. I'm using Unity 2020, D21, but this should work with every other Unity version as well. Select 3D template and give it a name of your choice. I will name mine three-day FBS, then click Create. And after a few moments we have empty template from which we can start building a new game. First, I would like to rename this level from samples seem to level 1, because later we will add another level and it will be easier to load the different maps from the code. You will find all the scenes in the section called project. Finally, we can proceed with adding first elements to the game. When we want to add something to the scene, we need to go into the section called hierarchy. By default, we have main camera and directional light already on the scene. Now, I would like to begin by adding some terrain to the game to work on. If we make a right-click on the empty space in the hierarchy window, we are presented with a lot of options to add directly to the scene. For the purpose of this class, we will go under 3D objects and select Cube. Double-click on the new element to focus on a cube. Of course, we need our terrain to be bigger. Select the element and we will be able to apply changes to the QC. I will set the x and z scale 232. These will give us a lot more space for our player to move. I will also rename my QC from QC to ground. Then under the name, you will find a drop-down menu where we are able to select to which layer this element belongs to. We will create a new custom layer called ground. We will need this later when we will add a movement to the player with the ground set, we can finally create the player in the hierarchy and create new empty object and rename it to player. To make this blurred, do anything, we need to add some components. First, we will add character controller, which will give physical abilities to the object. I need to move my player up from the ground to make the object a bit more visible, we can add a capsule to it, select the player, right click, go under 3D objects and select capsule. Of course, because we are developing first-person shooter, we need to change the point of view. In other words, we need to move the main camera under the player. This will make a camera to be a child object of the player, and it will move with the player to adjust the position of the view. Let's reset the transform component of the camera and use Move tool to set it in the right place. One last thing, we will create an empty object at the bottom of the player. It will serve to detect if the player is standing on the ground. We will need this later on when we will be adding a movement to the player, ground check would be appropriate name. Use Move tool to set it in place. 3. [1] Camera Settings: After setting up a player object, it is time to add some functionality to it. First, we will add a script to the main camera called Look. This script will move or actually it will rotate the camera and the player according to the mouse input. After we have created and added a new script, we can open it up in the Visual Studio by double-clicking the script component on the object. By default, we have start and update methods on the script, and we will be using both of them. But first, we need to declare three variables. First one, public transform player. This will serve as a reference to the player object in the game. Second one of type float will be variable to declare how sensitive we want our mouth to be. Let's try it with a value of 100. And the last variable, this one needs to be private, will be extra rotation and will be used as a value of how much we want to rotate the camera. In the start method, we want to set our pointer to be locked as we don't want it to go off the screen. The rest of the functionality will be written in the update method. With each update, we will be declaring to float variables mouseX and mouseY. Values of those two variables will consist of input on given x's, multiply it by a mouse sensitivity and Time.deltaTime to have consistent movement no matter of a device frame rate. With variables set. We can already use mouse Y to rotate the camera up and down. But we need to limit the rotation of a camera to be between minus 90 and 90 degrees. Otherwise. Blair, good to rotate the camera past that position and look behind his back. After that, we can apply the rotation on a camera using transform dot local orientation. With mouse X, we can rotate the body of a player to left or right just by using Rotate method on applier variable. Save the script and go back to Unity. To make this code work, we need to connect our player with the script. And because I forgot to remove the capsule collider from capsule in the last chapter, we will do this now. Why? Because character controller already has a building collider and we don't need two of them. Finally, we can test the progress, press the play button, and we can see the player looking around. The Great. 4. [1] Player - Movement: We have given that Blair ability to look around. Now, let's make him walk around. We will create a new script called Work. Open it up in Visual Studio. This time, we will need to declare more variables. First, we need a reference to a character controller that we are trying to reach. I have named mine CC. Then we need for public float variables, speed, jump height, gravity, and check radius. Speed will affect how fast we want. The jump height will affect how high we can jump. You can set your gravity value to any number you want, depending on a game you're trying to build. I will leave mine to be minus 9.81 as it is on Earth. Check radius will tell the script how far from the ground check point it should look for ground layer public transform ground jack will serve as a connection to players ground jack object that we have created earlier. What is ground will tell us which layer in the game serve as a ground or surface which we can walk on. And we will need private bool is grounded to check whether or not we are standing on the ground. The last one we need is a vector called velocity. Will be using velocity to make player jump. As we will not be using start method, we can delete it. All of the logic will be written in the update method. With each frame, we need to check if we are touching the ground. If we are, then we can jump. Otherwise we cannot. We will be drawing invisible sphere around the grounds Jack object. And we'll be saving the value true or false in the East grounded variable. When we are standing on the ground, I want to apply negative velocity to the player. From personal experience, I can tell you it behaves better that way. You can experiment with values and see what works best for you. I will apply a negative velocity of minus two. Next up, we can collect input from keyboard on both axis. Let's say if input from a horizontal one in float x and vertical one in float z, horizontal input will move the player left or right. Why vertical input will move it back or forward? Then we want to create a vector three variable with given values, name it, move. These will tell the player in which direction to go. Finally, we can move the player using Character Controller reference. We need to multiply a move vector with speed and Time.deltaTime again, to keep it consistent on all devices, no matter of a frame rate. Save the script, and go back to Unity. First, we need to connect character controller of the player with the script, then set what is ground to ground. And lastly, connect ground checked with the script. And now if you press the Play button, we can try walking around. And it is indeed working. But we still need to add jumping ability to the player. So let's go back to Visual Studio. For a player to jump, we need to constantly check for a keyboard input with simple if statement. We can check if player is pressing the jump button, which is by default set to be spaced button on our keyboard. If player presses the jump button and the value of the East grounded variable is true, only then we can jump. We will need to use a MATLAB function and some knowledge from physics. And we shouldn't forget to multiply by Time.deltaTime two times because physics finally reduce of our Character Controller reference, we can apply this velocity to play an object. We can save the script and go back to Unity. And after a few seconds, we can try if everything is working fine. And I can walk around and jump. Good job. 5. [1] Player - Shooting: The third important mechanic that we will discard today is shooting. First, we will learn how to add across her to the screen. Let's add new user interface element to the screen Canvas. And on this canvas, we add an image. I will change the color of this image to read and size to 10 by 10, makes sure that image is placed in the middle of the screen. Now, when we are able to aim, we can add a new script. This time. We will attach it on our main camera, create new script called should, and open it up in Visual Studio. Only two variables will be needed in this script. First one of type camera will be our reference to the main camera in our game scene. We can name it FBS camp. Second variable, which represents the range of our weapon. For example, how far we can shoot with our iPhone. I will set my range to be 100 units. We can delete. The start method, will only use the update for this one. In the update method, we need to keep jacking for user input. We can detect if the user presses the left mouse button, which is usually the fire button in these type of games. If the fire button is indeed pressed, we can call a method that will send an invisible array in that given direction. So let's create this method. I will name it should, right? And it will consist of only one if statement. We will send an invisible array in the given direction for 100 units. And if we hit any object and the way we will save the information of that object in heat variable, then we will print out the name of the object or a simple message saying missed. If you don't hit anything. All there is left to do is to call this method. When the user presses the fire button, we can now save the script and return to unity. To test this out. Of course, we need to connect the camera with the script. Seems that I have made a mistake somewhere in the script. And we asked, by mistake, I put space between 51. It should be written together. Now, it works perfectly great. And we are also getting messages down in the console window. If we miss or with the name of the object, we hit. 6. [1] Level 1: With basic mechanics setup, I would continue with building up our level 1. Here you have all the freedom. You can design your levels however you like. My idea is to make some sort of platformer. My level will be made out of different platforms, and the player will have to go from platform one to the last platform. On those platforms, I planned to create two different, let's say obstacles. One will be deadly, and the second one will actually be a bouncy platform that will shoot you up in the air. And that's how you will travel between platforms. Idea is really simple, nothing fancy, but it will show you how you can start building your own levels. So I hope you will get creative with the design, same ideas, anti, hope you will share your creations with us. As you can see, I will try to build up my level by only using 3D cubes of different sizes. Of course you can do the same or maybe tried to find some assets in the Unity Asset Store. You can find a lot of great and free to use options there. So my first platform here is bouncy platform. This one will shoot you up in the air and you will need to land on the second one, which I'll look great in a second. Designing a level could be a lengthy process. And on this chapter, I will not tell you how to design your levels. It is completely up to you and your imagination. I will just create, let's say, three main platforms to show you how to handle a game from start to end, and how to load the next level when player finishes this one. So all I'm doing is creating a bunch of cubes and reshaping them in the right form and placing them on the right position, your level could look completely different. And that's the beauty of game development as you can really create unique words. Just don't forget to set layer on all of those platforms to ground. Otherwise you will not be able to jump on that terrain except if that's part of your game and you are going for it. I will add two obstacles on my second platform. So player who need to be really precise where to lend, because the first obstacle will be deadly. And second one, we should show up on the last platform. I will do the same with less platform, except there will be no BNC platform. Instead, I will make the second platform to be the finish of the game, and it will transfer you to level two. But before we add any functionality to the map, I would like to add some colors to the platforms, so it will be easier for the player to know which obstacle is deadly and which is bouncing. I will use this really good package from Unity Asset Store, which is free to use. And it comes really handy when building a prototype games. It is called grid box prototype materials, and you can download it from Unity Asset Store. Now I just need to organize my platforms. I will resize them and change the names. The last bouncy platform will be renamed to finish. So let's import the package with materials. I will use white material for main platforms, for bouncy platforms and finish, I will use blue material. And for deadly platforms of course, I will use read. The last thing we need to do with our platforms is to assign them tags, which means each type of platform will have its own unique tag. So we will create three tags, bouncy, deadly, and last, since Unity it will not let us create finished stack. We will create attack called last. And when we have those texts created, we need to assign them to the platforms. So all the bouncy platforms will have deck called bouncy. Deadly platforms will have tech named deadly, and the finished platform will have deck called. Last. After that, we can add functionality to the map. 7. [1] Functionality of the Platforms: It's finally time to add functionality to the platforms. We will create a new script on the player called movement. Create and open the script in Visual Studio. First thing we need to do is to import Unity engine dot sin management, which will allow us to load the different scenes and levels. Then we can delete both methods because we will not use them. Instead, we need to use method called uncontrolled collider hit. This method will be called when the player collides with other objects. Inside the method, we will check with which platforms we are colliding. That's why we assigned texts to the platforms. So we can now check for the attack with simple if statement. I will also create a new reference to the work script. So we will be able to call functions in that script. Let's create for each statements for four different tax. I know we have created only three, but I plan to add another one, which will be called Bono's. And it will come in the shape of applicable object like coin or something like that. I will also create new public method inside the script. So we will be able to call this method from movement. Let's name it bounce, set the velocity to much higher value, like 15 or 20. If we go back to movements gaped, we are able to call this bounce method every time player touches the bouncy platform, all we need to do is to call the method using the reference we have created earlier. I forgot to give my reference a name. Let's call it work. And now we can call the bounce method. In the first if statement. When the player touches the deadly platform, all I want to do is to reload the level. You can create new health script and decrease players held, or you can create game over transition. But today we will only be reloading the scene. For loading scenes, we need to use scene manager and we need to tell which level we want to load. We can use the name of the level or the index of that lemma. I will show you both methods and you can decide which suits you better. We will also use Scene Manager when touching the finished platform. But this time we need to load the next scene in the game. Again, we can use index or uname. I will go with name this time. But be careful that you don't make any mistakes when spanning the name. Save the script, and returned to unity. We need to connect work script with the movement. Next up, we will create Level 2 in the project window, create new scene in the Scenes folder, give it an appropriate name, like Level 2. I will only add a label to the second level. So we will know that everything works fine. Before we continue, there is one important thing left to do. We need to add all the scenes that we have created so far in the Build Settings. Go under edit Build Settings. And now we need to drag all of the scenes that we want to include in the final built in these empty window. And we can find any try. Our platforms work as they should. So it seems that everything works fine and we can continue with developing the game. 8. [1] Adding Time Limit: So unit is telling us that we need to create an attack called Bono's. Let's do it the same way we have created previous tags. We create a new one. After that, I would like to add a label to the screen, which will serve as a timer. I want to make these levels time-limited. And if buyer doesn't finish us in time, it is game over. We already have a canvas, so let's add the next element on it. Double-click on the canvas and toggle to the mode so we can see the canvas. We can resize the text element and modify the text component. I want my text to mean the middle and fonts to be bigger. The color of my text will be white and position On top of the screen. We can lock these texts to be always attach on top of the screen. We can now add a timer script to the player. Great, Annette, then open it in Visual Studio. Besides scene management, we also need to import the Unity engine wi this time because we will be dealing with text element in user-interface. Then let's create a reference to this text element. We also need a float variable to tell how much time will be given for each level. And a Boolean variable to stop or start the timer. I want to start my timer the moment the script gets loaded. So I will set my runtime and variable to true in the start method. The rest will be done in the update method. With first if statement, we will check if timer is running. If yes, we can check the second condition. If there is still time remaining. If you run out of time, we will stop the timer and reload the scene. If there is still time left, we need to set the value of time remaining variable to be minus Time.deltaTime. And we need a method to display the time on the screen. So let's create one. I will give it a name displayed time, and it will take a parameter called Time to display of type float. This method will take the remaining time and will displayed on the screen using the text element we have created earlier. But we will display only seconds, no milliseconds. We can now use this method and give it a time remaining variable as a parameter. Save the script, go back to Unity and connect the text element with a script. So the timer is working, but it is displaying a negative time. And we need to correct that. I have made a mistake in the script in the display time method, first line of code, there is a minus sign which came here by mistake. If you remove it, the timer should work fine. So timer works and it is restarting the level if you run out of time. For the last chapter, I would like to add the bonus objects in the game. 9. [1] Adding Time Bonus: For the last chapter, I would like to create applicable object, let's say time bonus. We can again use QP for that. I will apply orange material to my bonus cube. Of course, we need to name it properly Bono's and we should not forget to assign the bone stack to it. Then we can add a bonus script to this object and open it up. In Visual Studio. We can delete both of the methods because we will use only one simple custom method to destroy the object when it collides with the player. Name, it destroyed bonus. That's it for the bonus object. Save it and go to movement script. We can now finish the last IF statements that we have left empty. First, create a reference to the timer script. So we will be able to add a time bones to the player. Then in the if statement, at, for example, five seconds to the time remaining variable. After that, we can destroy the bonus object using the method we have created before. When we go back to Unity, we still need to connect new timer script with movement. I would also like to show you how you can create a prefab of these bonus object. Why would you want to have a Prefabs? Because objects like that can be re-used many times in the game. And by creating a prefab, you can reuse one object million times no matter of a scene. Just drag the bones object from the hierarchy window to the project window. And you will see our new object with blue icon, which indicates that we have a prefab to use it. Just drag it from the project window to the scene view and place it on the right position. And just like that, you can have many breakable objects on the scene. And that's it for this class. I'm really thankful for the opportunity to teach you, and I hope you have gained new knowledge from this class. Now, I challenge you to create Level 2 of this game and share it with us. You can use any acid from Unity Asset Store or just like we did, use the cubes to build prototype levels. You can try to add a health script to the player and decrease the health every time he touches the deadly platform. Or add a new object that will damage the player. Maybe find a weapon in the Asset Store and attach it to the player. Deep. You will need to attach the weapon to the camera. So weapon we will follow that camera. It is completely up to you. Use your imagination and don't be afraid to try new things. And if you have any questions, do not hesitate and send me a message and I will help you. See you in the next class. Ciao. 10. [2] First Platform and Player: Hello, Welcome to part one of my class. As you know, by now, we are creating a platform or from scratch. So that's why I have empty project in front of me. We have this sample scene with main camera, and that's it. In first chapter, we are going to rename this existing seem to level one, and we will create Level 2. After that, we need to add these new scene to the build settings. So later, when we will try to load new levels, we can use the name of the scene or the index that comes with each level to load this level. And if I'm going too fast, I recommend pausing the video on each step. Now I would like to change the ratio of my game screen to 16 by nine. And background color on main camera from blue by default to gray. I will use colored beaker to get these gray color here. Now we are ready to add first platform and player to the game. Since we don't have any graphic acids to use, I recommend using simple shapes like squares and circles to create first prototype. Later, you can add your custom graphics. Actually, that would be good idea for class project. To customize the game with your graphics. I import that might do shapes to the project, and I can already use the square sprites, the grid first platform. I will resize it to be a little bigger and change the name to platform. I want to add this platform and all the other objects on which player will be able to walk and jump on custom layer. So I will create layer with name platform. Later, you will see why this is necessary. After creating the layer, you should not forget to assign these new layer to the platform. Last component we need to add on the platform is box collider 2D. Otherwise player will fall to every object, needs to have some sort of collider attached to it in order to detect collisions with other objects. We leave everything as it is. Using the square Sprite, I will create my player, but I will change his color to green. I named him player. Colors here are really not important. So you have all the freedom choosing them. Also, you probably have more artistic skills than me. Next few steps are also a little bit less important and are not necessary for this project to work. But I would like to add ice to my character. So he will not be so boring. Just two eyes and make sure that ordering layer of those i's is higher than players ordering layer because we want them to appear on top or in front of the player. After recreate the first i, we can simply duplicate it and place it in position. If you follow the step, I would ask you to make your player facing right. As we will irritate him later within the code. After the eyes, we will add an empty object at the bottom of the player. And this step is necessary, which will serve as a ground check. This object will tell the script if you are standing on the ground or are we in the middle of the jump? Place it at the bottom of the layer and name it grounds check. Famous with platform where it needs to have collider, in this case Box Collider, because it goes well with shape. We leave all the settings as they are. Then we need to add a Rigid Body 2D, which gives the player a physical abilities, and we will need it to move the player within the code. We want to change Collision Detection from discrete to continuous. And we also freeze the rotation except if you want your player to spin around, then leave it and you can get some pretty funny effects there. All that, we can finally start coding. First, we will go the script, which will take user input, and we'll use it to move the player. I will name mine movement, create the script, and we will start coding in the next video. 11. [2] 2D Movement of the Player: So let's open the movement script. As with any new script, we have two methods by default, start and update. We'll be using both of them. But first we need to declare some variables. I will declare all unnecessary variables, so we don't need to come back here. First three public float variables, speed, jump force and check radius. Speed will tell us how fast can move. Jump force, how high can he jumped? And Jack radius will tell us in what radius are we checking for ground using our grounds check object. Then I will declare private float x input to store user input when moving left and right. After that, Let's declare two integers, one public and other private. I want to use the public one to store number of extra jumps because this game will have ability to add double or even triple jumps. And the private one will be used in code to check on how many extra jumps blurs still can use. Also, we need a reference to rigid body of the player to be able to move him. We can make it private and then access to it within the code to rotate the player and to check if he standing on the ground. We'll be using to private Booleans facing right and is grounded. To make a reference to the ground check, we can declare a public transform variable. So you will see how to make a connection this way. We will connect them when we go back to Unity. And last variable in this script will be of type layer mask. This will tell us which layer in the game serves as a ground, or in our case, platform. That's why we have created a custom layer before. And we will assign these layer two, all the platforms which player will be able to work or jump, and objects like water or lava, of course, will not be on this layer inside of the editor, we can now assign the values. I will go with them for speed and jump. But you would probably need to test these numbers and see what works best for your game. Check radius will be 0.51 extra jump, which means double jump in my case. And you need to drag the ground check in the empty slot to connect it with the script. Platform layer represents our grant surface. Back in the script, we can finally start adding the functionality. First, go into start method. At the beginning of the game are player is facing right? So we can assign a truth value to it. We also want to assign a value to our extra jump wearable to bid the same as we declared in the editor. And the last thing in this method, Let's connect rigid body of the player with our rigid body variable. You saw before how to connect components using public variables. And this is how you do it within the code using private variables in the update method, we can start by checking if we are standing on the ground. If we are, we can reset the number of extra jumps. Then to give this is grounded variable r value. We can draw invisible circle around the grounds check object. And if it detects the platform, then we are grounded. And wherever we have a value of true, otherwise it will be false. Set the position to be equal to the position of the ground. Check object. Use check radius variable to declare the size of this circle. And what is ground variable will tell for which layer we are looking for. We will use X input variable to store a user input on the horizontal axis, which represents moving left and right. And it takes the input from left arrow, right arrow buttons, or a and D. This also works with joysticks. After we have first input, we can already applied to the player and move him on horizontal axis. For that, we need to use rigid body variable and its velocity to which we assign new vector to. Using the input multiplied by speed, we will not be changing the y value of the vector. Now when we can move the player left or right, would be a good time to implement a method that will be rotating the player so he will not be facing to the right all the time. First, we need to check if player is currently facing cleft and X input is greater than 0. In that case, we need to flip the player. In the second if statement, we will be checking if he's facing right and x input is lower than 0. Then again, we need to flip the player and to flip or rotate the player. We will create a new method, let's call it flip. In that method, we will reverse the facing right variable, and then we will rotate the player for 100 degrees on the y-axis. We can now call this method in both of the if statements. If we head back to the editor to try these out, we can see player moving left and right using the keyboard input. And the flipping method is working perfectly. But we also want blurred to jump. So let's go back to the code and add jumping ability to the player. And the bottom of the update method, we're going to create another elseif statement. In the first one, we will check for user input. And in the case that player has another extra jump, we will add vertical velocity to the player. We also need to subtract extra jumps wearable and by 1. In the else if statement, we will again be checking for user input. But in that case, when user has no extra jumps left, but he's standing on the ground so he can automatically jump. In that case, we will again at vertical velocity to the player. Makes sure that you save the script and go back to Unity. So try these out. The movement script is pretty much done and we can continue with creating all the other elements of the game. In the next video, we will adjust the camera to always follow the player tried to adjust the values in this group to your game. My jump seems to be a little too powerful. Here are also the screenshots of complete movement script. 12. [2] Cinemachine: To make camera follow the player, we will use package called SR machine. We will find it under Window Package Manager from where we need to import it in the project. Select all the packages in the Unity Registry and look for senior machine. You can find it on the list or use the search bar. Click Install. And after a few seconds or minutes, you will have seen a machine ready to use. You will find new window called SR machine select 2D camera, right? The way we get new object in the hierarchy, I will rename it to senior machine. After that, we need to drag the player object in the empty slots, follow and look at, try it out. And you will see the camera is now following the player. In the next video, we will continue with building up the level. 13. [2] Trampoline: Cameras set, we can continue with adding new elements to the game. And the first one I would like to show you how it's done is trampling. It is basically an object with collider and it triggers some sort of super jump function of the player. So I'm using white square with named trampoline with ordering layer of minus one. So it appears behind the main platform. Color will be green, same as a player and IQ scale of four. Place it in opposition and add a box collider so we can detect collisions with player. Then we will create new script, name it trampoline, where we will add functionality of the trampoline object. We can delete both of the main methods because we will be using only one method called on collision enter 2D. This method or function will be called every time something with collider collides with the object. We'd simple if statement, we can check if the name of the other object is player. And if it is, we can trigger Super jump on the player object. Later, I will show you how to check for tax instead of names. Now we have a place where we can call a super jump function, but we still need to create it. So to do that, we will go back to the movement script. And at the bottom of it, we will create new public method called Super jump. We can copy the basic jump logic and just multiply it, for example, by 1.25. Domains trampoline work. We just need to call this method every time player lands on the trampoline object. In the if statement, we need to get movement component of the player. And with that, we can call all public functions of the script, including Super jump. Make sure you save all the scripts. Go back to Unity to try if trampoline works, wait until project is updated and then press Play button. And the moment of truth. Trampoline seems to be working. You can change the values. You can add more to the super jump or you can reduce it. Make sure you adjust it to your game. But I forgot to add championing and on the platform layer. So let's do it now. At the end of the video, you will find screenshots of the good. If we, there was too fast. In the next video, we'll continue with building up the map, will add many new platforms and obstacles. So see you then. 14. [2] Self Destroying Platforms: We'd basic blurry movement. We can now extend the map. We can add new platforms and obstacles. And because we are making a prototype, not a real game, and we are using only square and circle sprites. There will be only a lot of copy and pasting. We will reuse some elements many times, and almost any element will be duplicated. Here you have all the freedom. You can design your level in January you want. Use your imagination. Don't limit yourself to what you see here. You can see that my player is currently getting stuck on the walls. And we can solve this problem really quickly. We can add physics material on any object with collider attached to it. And we can modify this material to be less or more bouncy, and we can set friction of that material from 0 to one. So going the project folder, create new physics material 2D and give it a name. Then select this material and set friction to 0. Now we can apply this material to any object where you don't want to have any friction. That solves the problem. I would like to create a bridge between those two platforms that will disappear after a second or two. Again, we need square. Let's name in the bridge and change the color to be different than other platforms. So player will note that this bridge behaves differently than other objects. We need to create new script, namely the bridge. And of course Box Collider soap layer can stand on it. Don't forget to give this breach on our platform layer and then open the script in the visuals to them. We can delete both of the methods. Then we can declare new public flood, which will serve as a timer. And we will be able to tell after what time we want to destroy the bridge. We want to trigger this timer when prior steps on the bridge. So let's use on collision enter 2D when we want to create a delay in execution like we want with these bridge, the best way to do it is using coroutines. They behave very similar to classic void methods, except we can delay parts of the code for a specific amount of time. In our case, for value stored in destroyed time or variable. Instead of void keyword, we use eye enumerator, set the timer, and then we can destroy this object and breach will disappear. To trigger coroutine, we need to go back in on collision enter 2D and started safe everything, and go back to Unity. Select the bridge and set the time, let's say 1 second, apply new material and give it a try. So let's see what happens when we go on a bridge. Of course, we need to wait for 1 second. And yes, bridge disappears. Great. Like always try modifying the code, change the dimer and adjusted to your game. You will find code screenshot at the end of the medulla. And in the next one, we will continue with building up the map. 15. [2] Detector: So we have created first obstacle that can potentially kill the player. I mean, when he falls off the map, we need some kind of method that will detect our buyer falling down. Using square. We can make some sort of really big transparent platform with Collider, which will reload the level when player falls on it. Make sure it is white and off and change the alpha value to 0 to make it invisible. We'll rename it to detector, and we'll add a script with same name. And of course, we should not forget to add a box collider. I will set my collider to be triggered. After that, we can move to coding part. We don't need any of the default methods. We will use on Trigger Enter to D because we said this collider to be triggered. But if you didn't set it to be a trigger, then use on collision enter 2D. In this case, both of the methods will work. The difference is if collider is said to be a trigger, objects will not collide with it, will just detect the touch. So when this method is called, I want to reload the level. But to load levels, we need to import new library called Unity engine not seen management. Then we can use Scene Manager to load or reload the scenes. We can tell the scene manager what level we want to load by passing in the index of the scene, name of the scene, or the safest way by getting the active seen index. That way we can prevent any mistakes when passing in the indexes. Of course, you can create some more advanced game or a sequence in your game with user interface and so on. But for this class, we will only discover where and when to call it. We can save the script and returned to unity to see if this detector works. Just jumped with prior of the map. And it works great. We can now continue with adding new platforms to the game. In the next video, I would like to show you how to add water to the game. Something really cool and not that hard to do. See you then here is a screenshot of the code from this video. 16. [2] Water - Buoyancy Effector: In the last video, I promised you we will continue with adding water to the scene. So let's do it. First. I would like to extend my map a little bit. I will copy this bottom platform two times. And let me add two new floating platforms. One here and second one here. So it will be sticking out. Then we can finally start with creating quarter object. We can reuse this bottom platform and to issue the extended a little bit so player will not be able to just jump over it. I want to add a lock in the water and player will have to land on the lock and write it for a while to get on the other side, I will adjust ordering layer of water or object to appear behind the main platform and change the color to blue. So it will look more like water. Name of the object will be water. After that, we need to sell box collider of the water to be triggered because we want to allow the player to go under the water. Otherwise he will stand on it. Lock object. We can copy this floating platform and move it on the surface of the water. Again, adjust the ordering layer so it will look like it is floating on the water. And of course, change the color to some shade of brown, like this. Name of the object will be locked. Now returned to the water. We will continue with it. Add new component called Bargain see effector to D. And to make this effective work, we need to set our box collider to be used by a factor. These effector imitate the behavior of the water and will be perfect for the job. I will change density to one and surface level to 0.5. Make sure you adjust these numbers to your needs. Then add new script. I will name mine water, open it and delete default methods we will be using on Trigger Enter to D. I want to end game if Player falls into the water. So we need to check if the object colliding with is player. We can do it also by comparing tax. But for that, we need to have deck on the player and we will do it in a moment. But first, let's just reload the scene everytime blur, false in it. We can copy the reloading client from detector script and of course import the scene management library. Make sure you save the script and returned to unity. We still need to add a tag to the player. So select the player object and select the player tag. We are almost done. The only object we still need to work on is lock. Somehow, we need to make it flow in the right direction. What we're gonna do is when player lands on the lock, we will add a flow to the water using script we're going to create. But to make lock move, it must have rigid body conference. So let's add it. I will change collision detection to continuous and freeze rotation. We can finally create script and write code to move this lock when necessary. Delete both of the methods and declare new public effector variable. This will be our connection to the effector used in the water object. Then using on collision enter 2D set flow magnitude of this effect or to 12 or any number that works for you. Don't be afraid to play with these numbers. Safe everything and returned to unity. Connect water object with new script. And we can try it out. Jump on the lock, and it seems to be working great. We are floating on the water. We'll just add another platform on the other side, so Locke will not fall off the map along with the player. That's how you make water into the, I hope it will somehow help you in development of your game. Of course, you can use this effector in many ways, not just for the water. Don't be afraid to play with it. Here are screenshots of the code if veto was too fast. In the next video, we are about to discover another great effector, That's platform effector, which allows you to pass through objects only one way. So see you in the next one. 17. [2] Platform Effector 2D: As promised in this video, we'll learn how to add one way platforms. Those platforms allow us to pass through only from one direction and are really easy to create. First, let me extend the main platform for one more block so we will have more space here. Then we can reuse this floating platform. But let's scale it down a little bit and duplicated. But on the second platform, I will just ordering layer two minus1 and we'll change the color so pleasurable and all that this platform behaves differently. And then duplicate the first platform one more time and place it on the other side of the group. I will change the name of the middle one-to-one way. So it will be easier to find in the hierarchy. And all there is left to do add new component called Platform effector 2D and try it away. We have a fully working one-way platform. Just make sure you check used by effector box in the box collider window. As you can see, we can jump through the platform, blurred dance, dance on it. He doesn't fall down. Of course, you can use these effector in many different scenarios. You can change the rotation of it. You can set on which colliders it works and so on. Don't hesitate to experiment with it. In the next video, we're going to add new obstacle, lava, which will kill player instantly. So see you then. 18. [2] Lava: Lava obstacle will be one of the easiest in this class. It will not have any special effects. It will just reload the scene whenever player lands on it. But I would challenge you to add some special functionality to it. Maybe buoyancy effect or, or maybe it doesn't have to kill the player, just damage him and bounce back in the air, just like trampoline. But I will leave this to you and I would be happy to see your creations if you choose to share it with us. So copy the last bottom platform again, decrease ordering layer and change color to red to look more like lava. Then at another main platform to the other side. So player can jump over Delilah and land on the ground. Renamed the lava, object to lava, said Box Collider to be a trigger and create new script called lava. As I said, my lava will only reload the scene so I can pretty much copy the code from water script. But I hope you will try to add some unique functionality to it. Save the script, and try it out. Our lowess should work. If you have any problems, here is a screenshot of the code and you can check where is the problem. We can now continue with exciting stuff like adding coins and timer to the game, but all that in the next video. So see you then. 19. [2] Finish Pad: We have created some obstacles in the game. And if player survives all of them, we need some kind of finish bed to reward player or maybe low to the next level. So let's create new object. We can reuse this floating platform that will serve as a finish of the game. Adjust ordering layer and change the name to something like finish. Leave the color to be white as we will be changing it to the script and create new script. I will name mine level manager. Descrip will manage most of the game logic. That's why these name. We will start writing level manager script in the next video. 20. [2] Level Manager UI: All the logic of our game will be written in the level manager script. So let's open it. First. We need to import to libraries Unity engine wi and Unity engine not sin management. We are already familiar with sin management and the UI library is needed when we want to work with user interface, like buttons and labels. For example. I would like to have two labels on my game screen. One to display coin balance and want to display time left. To finish the level. Player will have to collect all the coins that are available on that level. Otherwise he cannot progress on the next level. Also, each level should be time limited to put extra pressure on players. Time remaining variable will tell us how much time we have to finish each level. Default value will be 45 seconds, but you can change it later to other value. We will create custom timer, and timer is running. Variable will be used to start and stop this timer. Next up, I want to change the color of the finished pattern depending on how many coins are collected. If player collects all the coins, bad should be, let's say green. And player will be able to progress on the next level. Otherwise, it will be read and will not do anything. That's for the variables in the start method. We can start the timer when game loads to begin the countdown. If we return to unity for a second, to set the variables of the level manager, we can now choose the colors for the path. For me, close color will be red. And don't forget to set Alpha channel to 255. Otherwise, that will be invisible and opened color will be green. Again, alpha needs to be 255, or you will not see the PAT. After that, we can add user interface. What we need are two labels, one for coin balanced and 14 timer. In the hierarchy at Canvas. And then on that canvas, add text element. Double-click on the canvas to focus on it. We can see our text element on the middle of the screen. I want to have coin balanced displayed in the upper left corner and timer in the upper right corner. Rename it to context and adjusted to look like you would like it to. I will resize it, change the color and the size of the font and make it bold. So it will be better visible on the screen. But make sure it is adjusted to your game and taste. You can always switch the game view to see how would it look like on game screen. After I have my text ready, I can duplicate it and place it in the right corner. This will be my timer. Of course, change the name and placeholder text. I will lock this text to always appear in the top right corner. Same width contexts, but of course in the top-left corner, no matter of the screen size, then connect new text elements with Level Manager script. So we will be able to display and change the text of those labels. We our script. So we have basic user interface ready. You can add more labels depending on the game you are working on. And we still need to learn how to display text using script. But before we do that, I would like to create new element coin. So once we go back in the level manager script, we can finish it completely. So join me in the next video where we will discover how to make coins that player will need to collect. See you. 21. [2] Level Manager: Creating breakable objects like coins and gems is quite simple in Unity. So let's get to it will make a coin object using this white circle. Just scale it down a little bit. 0.50.5 for x and y scale. Change the name to coin. I would change the color to some shade of yellow to look like a golden coin. Then we need to add circle collider so we can detect collisions with player and make it to be triggered. Finally, we can create coin script to add functionality to the object. Coin and level managers scripts will be connected in some way. So we can as well continue with development of level manager. First, we can make our timer work with nested if statements. We can check if timer is running, and then if true, we can check if there is time remaining. If time is up, we can stop the timer. In my case, I would also like to reload the level when we ran out of time. So I can copy the reloading Klein from water script to display time. We're going to create new method. I will name mine display time. We can already call this new method inside the second if statement. Inside of the method, we will subtract time remaining variable by time best from last call. Then we will pass time remaining in new float variable that will be saved as an integer, so we get only whole numbers. Finally, we can display a new time remaining in time text as a string. That's for the timer. We will try it out later. Next up, we can add functionality for when player lands on the finished pet, because we have collider on the bed, we can use on collision enter 2D. And if coins collected and coins available match, we can call some sort of level completed method. So let's create such method. For this class. We will only load the next level. But you can of course, make more complex logic. Maybe call some manual which scores or something like this. Make sure that you add plus one at the end of the loading client. That's for the finished pattern logic. Then we need to create a method that will display how many coins are available and how many are already collected. Make this method public. Mine is called to refresh coin balance. Inside using context, we are displaying coins that are already collected and number of all the coins in the scene. Then we are checking if br collected all the available coins. If true, we will set color of finished pet to open color, which is in my case green. Otherwise, if player still has coins to collect, bet will be colored in red, which is my closed color. That's for the level manager script. We still need to add functionality to coin object. So switch to coin script. First, we will declare new private game object variable called level manager. This will be our reference to level manager of current level. Then inside of the start method, we will try to find game object name finish. When coin is added to the scene. I want it to automatically at 12 coins available and refresh coin balance. After we have that game object, we can get level manager component of it to add one coin, two coins available, and again, refresh the coin balance. When coin collides with player. We can call on Trigger Enter to D. In this method, we will add 12 coins collected, and of course, we need to refresh coin balanced once again. Finally, we can destroy the object. That's all for the coding part, save the scripts, and return to unity. Final trick I would like to teach you is how to make one object re-usable on the same level or between multiple levels. We call such objects prefabs. Once you have your object or adding, just drag it from the hierarchy into the project folder, you will see new object with blue icon, which indicates that this object is preferred. To use this prefab, just drag it on the scene, and that's it. You can use this method with any object you want, and it can save you a lot of time to try it out. Let's use this prefab three times and then press play. As we can see, contexts is correctly displaying the number of coins in the level. Timer also seems to be working. Then go and collect all the coins to see if everything works as it should. For now, coin balance seems to be working. As we can see, finished bat is colored red as we still have one coin to collect. And if we get that last coin and jump again on the finished pet, we are progressing to level two. Great. And that's also where it's your turn to continue this class. We have pretty much covered everything that I had in my mind. We have curated complete level one. We have designed objects that can be reused on many levels. And I believe you are more than capable of creating next level on your own. If you have any additional questions, do not hesitate to ask, and I will try to respond as soon as possible. That's all from me. Thank you for taking my class and I wish you all the best. Bye. 22. [3] Ground, Light and Player Settings: Hi and welcome in my class, as you can see, I have new empty project here. And first thing I would like to do is to add 3D cube as a ground layer. So we will have a terrain to work on. Later, you will add more objects and we'll create a bigger map than this one. I will rename my cube to ground and we'll add it on a new layer, also called ground. And I want all the terrain objects to be on this layer. Later we will learn why. Of course, we should scale up the cube. I will set the X and Z values to 100. Then I would like to change the color of my directional light too wide. This is completely optional and will not affect the game itself. It just my personal preference. I will also increase the intensity to one points to. Finally, the player. For the first part of the class, we will be using 3D object called cylinder, rename it to player and adjust the position. Then we should remove capsule collider from cylinder as we'll be using other collider. We can also assign a player tag to the object. Maybe we will need it later. Now, next steps are also not critical, but I would like to add cube object to the player. And it will serve as a head of the player. So it will be easier to see in which direction we are heading. Scale down the cube and place it in position in front of the player. I will also show you how to quickly create new materials for 3D objects. Great new for learning project window to hold new materials. Then create two new materials, one for body and one for hat. The color of my body will be gray and head will be in red color. After that, select your player and simply apply new shiny materials. With that done, we are ready to start working on the actual controller. 23. [3] Player Movement: So we have prepared player to develop movement for it. To move player around, we need to add character controller. This will equip player with physical abilities. And to make use of this new component, we will add another. This time we will create movement script. The script will take care of user input and transform it into player movement. But before we start coding, let's add empty object to bottom of the player. This object will serve as a ground check. And to build palace. If we are standing on the ground, rename our object to something like ground jack and place it at the bottom. Great, Now we are ready to start coding open movement script attached to the player. By default, we have two method, starts and update, and we will be using both of them. But first, we need to declare a couple of variables. I will start with the public reference to camera in the game, so we can use it later. Then we need to reference to Character Controller so we can move player around and ground check to detect if you are standing on the ground or are in the middle of the jump. Next reference is to Player Animator, which will be used in second part of the class to animate the player. Public layer mask will tell us which layer in the game serve as the ground. Then we have six float wherever was, spit is pretty self-explanatory. It will tell how fast player can around. Same with gravity. More explanations needed here. I guess jump force will tell us how high player can jump. I will go with five, but you can play with numbers, of course. Next type, check radius, which will tell us how far from gowns check object. We will check for ground layer. Last, do float wearables will play a different role. Turn smooth time and turn smooth velocity will be used when blurred will rotate to make it's rotating more smooth. We don't want to have snappy rotations, but smooth and nice. Last variable is of type vector 3 and 2. We need it to save velocity of the blurred in it. This will come handy when player will wants to jump. Finally, we can begin coding. In the start method. I would like to log the mouse pointer to the screen. These will prevent pointer going off the screen or to be visible. It takes only one line of code to do that. I just realized that I forgot one variable and that is private boolean is grounded to hold true or false value, whether we are standing on the ground toward not. I promise you, we have all the variables we need now moved to the update method. We'll make use of that Boolean right away. We will draw invisible sphere around ground check radius of that sphere will be equal to the value stored in the check radius variable. And we will be looking for one specific layer which will be stored in what is ground variable. If we detect ground player is grounded variable will have a value of true, otherwise it will be false. With first if statement, we will check if player is standing on the ground and we will apply a negative velocity to him or her. These will hold player down and I found it useful. It makes movement more realistic. Next, we'll collect user input, but I want to collect input on it. Went player is grounded. It's my personal preference, and I challenge you to try both methods. So all the code will be inside of the if statement. We declared to float wearables, one for horizontal and one for a vertical axis. And right away, we can use these inputs to move player. So let's use this new values with new vector 30 variable, I will name mine direction. Normalized keyword will prevent Player going faster if we hold down to kiss, Let's say one for horizontal and vertical, then we'll create another if statement. And in case that the player has any movement, we will apply new direction to the player and we'll rotate him in the right direction. Here, we will need to use some mathematical functions. Don't be scared, just follow me and I will explain everything as we go. First, we need to calculate target angle in which we want to rotate the player. But then we also want to make this rotation as smooth as possible. And here comes really handy function called smooth damp angle. Finally, we can apply this new angle to our player using its rotation. After dating the player, we also need to move him or her in the right direction. For that, we will create new vector 3 with our target angle. Then we can finally move the player using character controller. And that's actually everything I needed to move the player around. On. The mechanic that is missing is of course the jumping and it's quite simple to add solids do it. We need to check if the player presses jump button, which is in unity by default space button. And if blurs, stands on the ground. If yes, we can apply vertical velocity to the player. After if statement, we need to continuously apply gravity to the player. And after all that, we can finally apply new velocity to the character controller. All that done, our script is complete, save it and returned to unity. After a few seconds, we will get updated movement script. We need to make reference to the script. Connect main camera with first slot. In the second slot, we drag the character controller and players ground check object goes in the third slot. We will connect animator later. Finally, select which layer represents ground. Our script is for now completed. Player should move around. But the problem right now is that camera stays in one place and we want it to follow the player around. So in the next short lesson, we will also learn how to do that. See you then. 24. [3] Camera Settings - Cinemachine: We have prepared movement. Now, let's add camera to it. For that, we will go under Window Package Manager and we will import Sina machine. Since the machine is sufficiently Unity package that takes care of camera movement in many different scenarios. When Package Manager window is opened, go under all packages in Unity Registry, then look for cinema machine selected and click install. The installation process can take some time. So I will fast forward this part. When installation is completed to go under new window called SR machine and select create free look camera. This will create new virtual camera, which will act as the brain of the main camera. I will rename my virtual camera to 3 look camera. And I will place it higher in the hierarchy, so project stays organized. We can see two empty slots. Follow and look at drag player object to both of them. And our main camera will always follow the player around the scene. But we still need to set the correct angles for the camera and its behavior in different situations. A lot of settings here is about personal preference. And it highly depends on the type of game you're developing. So you probably want to spend quite some time here to play around. I like to invert the values on y-axis but not an X. Then I would like to adjust height and radius on Alteryx. We're almost there at the bottom. We have option to add an extension. And I would like to add senior machine collider because we want our camera to a wide certain obstacles on the scene. And we want to have a good look on the player on time. I will set my camera to collide against ground layer later you can add more layers here. I also want my camera to ignore player, so let's select player tag. And finally, what we want to do in case we have an obstacle in front of the camera. I want my camera to be pulled forward. And I can achieve that by setting the strategy window to pull camera forward. That's it. I believe we have done everything to now have fully operating third person controller, press Play button and try it out. Great. Control works as it should. That's all for the first part of the class. If I was going too fast, re-watch the video or send me a question, I would be happy to help. In the next lesson, we are starting with the second half of the class. As I will show you how to use character animations with that controller. Can't wait. See you then. 25. [3] Animations: Hello and welcome to animation part of the class. We're going to start by deleting player and we have created earlier because we'll be using real character this time. We'll be using official Unity package called 3D game kid character back. You can get this back for free on Unity Asset Store. I have downloaded it before. So all I need to do is to go to Package Manager and import it in your project. It is a fantastic package comic with five different characters and a lot of ready-to-use animations for each character. With all that included, It is great place to start working with animations. I will import the back and fast-forward disorder. So baggage is important and we can start exploring the world of animations. As I said before, we will only learn how to use animations with controllers. And we will use already prepared animations, will not make them from scratch because that should be a class on its own. Maybe in my next class. In project window, we can see new folder with our characters, open it, go under characters. And the dare, you can choose between five characters. I will select Allan and two, you do the same if you want to follow this lesson as not all characters have same animations. But later, I would be happy if you tried to use an animate other characters as well. So Jack Ireland, character from models folder onto the scene, and we are ready to go. We need to set up this model in the same way as we did with cylinder before. First assign a player tag, then add character controller. But this time we need to make some adjustments to it. We need to change the height of the collider and also the centerpoint microfilariae will have height of 1.6. So center of that is around 0.8, but I will set it to 0.85. I will also set the radius to 0.4. Then we can reuse the movements groups from before. Again, we need to make references, drag in the main camera and character controller. We are missing the ground jack on player. So let's make one at the bottom of the player. We can also jacking the animator that comes with this character. Finally said the what is ground to ground. To make use of the Animator, we need to open the animator window. Animator is placed where we take care of characters, animations. We can set exactly when we wanted different animations to play. The open animator and go under Window Animation Animator. Each character that we want to animate must have animator controller. And then we need to modify this controller using animator window. Let's create new animator controller called Allan that will handle all the animation on player character. Then select player object and drag new controller under empty slot in animator component and double-click on it to open it in animator window, we can start adding animations. Now. As we can see, we have three default states, entry, any state and exit we will be using only first do soon. You will know what each state means. To make transitions between animations, we need to have some kind of conditions or parameters. So controller, we know went to display different animations. On my left, you can see little window called parameters. There we will declare two new parameters that we will turn our controller which animation should be played, declared new float called speed, and set a default value to 0. This one will tell the animator whether should it play around or idle animation, then declared Boolean, called grounded and set default value to true. This one will tell the animator went to play jump animation. We will be using two different animations, but feel free to add more. We can finally explored all the available animations, go under animation clips and search for Alan either extended and drag in Alan idle animation. It has these blue triangle on the left. These will be our anterior animation, which means it will play when we start the game. Then look for L and around forward and use first animation. This animation will be played when we will be running. But we need to make transitions between select idle animation, right-click and select Make Transition, make a transition to run animation. Now we need to set conditions. I will uncheck has exit time on all animation transitions. You should do the same. First condition to make transition is of course, speed. We want to make transition when speed is greater than, let's say 0.1. And also blur needs to be grounded. To make transition back, we also want player to be granted, but this time speed needs to be less than 0.1. That's all for the idle to run and back transitions. Now look for Alan jump and select Allan jump, beak. This will be our data animation. We will make transition to jump from any state as long as one condition is true when player is not grounded. Also, uncheck has exit time and transition to jump is ready. Of course, we still need to make transition from jump back to either autorun. This shouldn't be too hard. Start with transition back to either and uncheck x in time. Then we need two conditions. Speed should be less than 0.1 and player must be grounded. Transition back to Ryan is quite similar. Only difference is speed, which should be greater than 0.11. Last thing, select transition from any state to jump. And under settings, uncheck can transition to self. These will prevent playing this animation on loop. Our animation tree is completed. To make it work, we need to go back to movement script and set our parameters there. Insight of the first if statement, we will set our Boolean to be true. That means player is grounded. At the bottom of the second if statement will be best in Qin magnitude. When player will stand still, magnitude will be 0 and we will see idle animation playing. But when moving, magnitude will be higher than 0.1 and run animation will be playing. In the last if statement. When player jumps, we will set the grounded boolean to be false and jump animation will play. And that's it. Save the script and returned to unity. Earlier, I forgot to set free look camera to follow and look at player. So I will do that now. And then we are done. Our controller and animation should be working. Press play and try it out. As you can see, controller is working perfectly. Animations as well. If you have any problems, re-watch the video or send me a message, I would be happy to help. That's all for this class. All there is left is class project. I would like you to extend this platform and add new elements to it, tried to build new obstacles using 3D objects. I would also like you to experiment with movement script, tried to change values in code and see what happens with mechanics. Or tried to add new feature may be something like double jump or Crouch. Then I would like you to try to add new animations to the player using same methods as with either run and jump animations. They imported package comes with many ready-to-use animations. Don't be afraid to play with them. You can also change the player and discover all the animations that come with Unity Package. Feel free to play with them because this is the best way to learn.