In this lesson, you will get to know where to find game assets and how to import them. We will talk about prefabs in unity and learn how to work with them. And we will add a real character on our scene and give him physics components. Let's talk about game assets. They are everything and user of your app will see characters, background platforms and so on. First of all, let's create a new thing.
File no see. Um, but say this one. All right. So I encourage you to click here next to this thing you we have Asset Store and login into Unity Asset Store Have a bunch of absolutely free assets, both characters and backgrounds. And these assets are certainly useful when you are learning or creating your first game. And we can even click here three assets and we got a really very large variety of free assets, which is really great.
I will use this passport man from black hammer. Thanks, buddy. So click on Download here that I have already downloaded. So I have input here. And after you download it it just click on input and it takes a while for it to Be ready. So here are all the files, which are included in this pack.
Let's have a look what we have. We have sprites, it's just our character divided by parts, I can you see head leg shield. We also have animation here. And that's great. We got animation files. So we also have a demo scene and other files in case you don't need something.
You might uncheck the boxes like this, for example, but, but I'd like to input all these files convert. So now all the assets are being imported to our assets folder here. Let's hold on for a second. We already Yeah. So now in our assets folder, we have our load word, man. And it contains all the folders that we have seen previously.
And let's find our, our hero. Let's find his prefab. And I'll told you what what it is later. Whoops. minute. All right, let's turn on the plane mode.
And yeah, we see the animation of this character. So this position means idle position. So the character is tain still and do nothing but he has to do something just in order to look interesting. All right. Let's take a look at the hierarchy here. So you see that next to the sword man, we have this blue box.
So the blue box means that it is a prefab. prefab is a template unities prefab system allows you to create, configure and store a game object complete with all its components, property values, and child game objects as a reusable asset. When you want to reuse a game object, configure it in a particular way. in multiple places in your scene or across multiple scenes in your project. You should convert it to a prefab that is better than simply copying and pasting the game object Because the prefab system allows you to automatically keep all the copies in sync, so any edits that you make to a prefab assets are automatically reflected in the instances of that prefab, allowing you to easily make broad changes across your whole project without having to repeatedly make the same added to every copy of the asset. So let's take a look at this brief app.
It consists of what let's see. sprite render, right this prefab comes first or Sprite. Then a simple sprite like the ball we created before they are PNG files. Let's take a look. to small with can try to make it bigger. That is it.
It's his lack. Yeah, maybe. Yeah, it is. Definitely it. So yeah, in our assets folder, we have all these sprites, you see. And do remember, in the very beginning, we had only standard sprites, like circle and square.
But right now we have all these sprites because they're war in the assets pack that we have downloaded. And if we click on the word man, we see that it has there any mentor component. We will talk about it in the next platform. And of course, you can create a character or a background or whatever, by yourself. Just don't forget to put each body part to a separate layer. If we are talking about characters and if you're going to animate them later and if you work in Photoshop, save your drawings like PNG files and simply drag and drop it to your assets folder here, and then add it to your scene.
That's it. Our character does not have that important components you already know. rigid body and Collider, which means we need to edit. But in most cases, rigid body and collider are included to the character on the game scene. Let's find it here. More prep up here.
Yes, you see the hero from the GMO scene. He has the rigid body and capsule collider, but we are game developers. So let's delete it and add These components by ourselves let's click here to component body dynamic type alright and collider yeah capsule collider is what we need can either use box Collider in this case or capsule collider. All right click on Edit collider make it bigger one more thing about prefabs we have created rigidbody and capsule collider Wilders work Man was highlighted and we have these small classes. Do you see it? That means that component is not added in the prefab.
You see the animator component doesn't have the plus find overrides here. Next choose your components and apply apply to prefab again. Apply apply to prefab. Alright. So now there are no plotters that's good, but a kind of bad way to do it. The better way is to click here and open our prefab and in this view, add components and a few add components Here they will be inside the prefab.
So I have created rigid body and collider for my player and now I need the ground create sprite sprite rename it to round choose one of the sprites something like this all right let's make it bigger well it looks awful but that's because it's it wasn't designed for this manipulations. All right I have my ground and now we need to add the same components For our ground box collider first added collider to make it just the way our shape is good and let's add rigid body the body type is static All right, and I want to do one more thing we have other any major here but I'd like to delete it because so to delete the component we simply need to right click on it and remove component All right, the this animator component was created by someone who created this, this character and this this scene, but it does not work just the way I wanted.
So I want to start from the very beginning. So no any Mater just rigid body collider and itself. Alright, so now we have rigid body and collider for the character and for our ground. Let's play the plane mode and I'm expecting my character to fall down. Yeah, of course. Hmm.
And one more thing, go to our character. Collie con, rigid body, find constraints here and check freeze rotation that If we don't do that, the character will be rotating while fallen. Although you may need him to rotate, it's up to you. But in most cases, it's better to phrase rotation along the axis. Hey, we have our character placing on the ground. Isn't it amazing?
Let's go to the next lesson.