‫Welcome back.
‫In this video, I would like to talk about a very, very important concept in unity and also about keeping
‫your project clean, because so far, we have simply created things.
‫For example, we have created some assets, we have created game objects, but we haven't kept our assets
‫folder, for example, tidy.
‫And also we haven't used something very important which is called prefabs yet.
‫And I would like to talk about those things and show you how to use them correctly.
‫So one thing is that we should have folders for the different types of assets that we're using.
‫For example, one folder would be scripts and in there we should have all of our scripts.
‫So for example, our player movement and our trigger script and whenever we create new scripts, we
‫should also put them into your scripts folder.
‫Then we have another one called Materials and we could even create two different ones.
‫We could create a material, one for simple materials and then one for physics materials.
‫But I'm just going to use the same folder for both and I'm going to drag my materials in there.
‫You can keep your scene or your scenes outside of any folder, or you could also create a scenes folder.
‫I personally prefer to have my scenes in my assets route folder, but of course you could go ahead and
‫create an additional folder for that.
‫Now, the next one that I would like to talk to you about is simply saving your scene.
‫So it's really important to save your scene before you close your project because scenes are not automatically
‫saved when you close your project.
‫And that could lead to you losing all of your game objects that you have within your hierarchy.
‫So objects are all of those pieces here.
‫Every single one of them is an object.
‫The main camera is in game object.
‫The direct channel light is in game object, the player is a game object and so forth.
‫And if we create a new object, we can simply create an empty object which doesn't contain any information
‫except for I hope you know which thing is always there for every single object.
‫It's the.
‫Transform component.
‫So every single object, even an empty one.
‫So let's create a new game object which is empty.
‫It still has a transform component.
‫All right.
‫So you can create game objects this way.
‫So 2D objects, 3D objects and so forth.
‫And those objects, they are within your scene.
‫So whenever you, for example, close your scene, those objects are not available anymore.
‫And if you want to make them available for, for example, other scenes or in general want to reproduce
‫them programmatically, what you can do is you can create prefabs out of them.
‫So let's say we want to have this cube that we have created here as a prefab that we can re-use any
‫time.
‫What we can do is we can drag that cube into our assets.
‫And as you can see, it will be a cube dot prefab, so it will be a prefabricated, which we then can
‫re-use any time.
‫So now if I delete all of my cubes from here, let's delete them.
‫I can drag a new cube into my game any time.
‫So let's drag that in here.
‫Let's reposition it a little bit, and now I can drag another one in here and so forth.
‫So these cubes that I create in here, they are prefabs, and you usually create prefabs out of many
‫different objects, all of those that you would like to reuse in different scenes or that you would
‫like to reproduce, for example, programmatically, a very important one which you always should have,
‫is your player, of course, because maybe you could die.
‫Or maybe you go into a different scene and you want to have the player with all of its capabilities
‫in the different scene as well.
‫So let's say a different level.
‫You want to have the same player in level two, three and four.
‫So it's really important to have it as a prefab so you can reuse it in a different scene.
‫So now that we have this prefab and this cube prefab, let's create a new folder, create folder and
‫call it prefabs.
‫And now let's drag all of our prefabs in there.
‫All right, so that's really important.
‫Prefabs are a very important aspect of game development with unity, and we will use that quite often.
‫All right.
‫So that's it for this video.
‫Now, you know what game objects are.
‫We have seen them before, but now you know even better.
‫And then you also know how to use prefabs.
‫Great.
‫So in the next video, we will have a look at components.
‫So see you in the next video.