From the course: Cert Prep: Unity Certified Associate Game Developer Fundamentals

Folders and organization - Unity Tutorial

From the course: Cert Prep: Unity Certified Associate Game Developer Fundamentals

Start my 1-month free trial

Folders and organization

- [Instructor] In this movie, I want to discuss something that many people think is boring. And I don't know maybe it is but if it is, it's certainly really important. It's the subjects of organization. One critical skill for any games developer is that as you're working in your projects you need to be organized. And to demonstrate organization in Unity and some tips and techniques for being organized I've opened up the FPS Microgame project which as you'll recall we created way back at the beginning of this course. So the Microgame FPS project contains a scene with a game inside it's a first person to shooter game. Now this game might seem pretty simple but actually it's far from it. And to see what I mean just take a look at the project panel. We begin inside the project panel and all of the assets in the data contained in this project are divided across four folders. But let's take a look at those folders themselves. For example, let's take a look at the mod assets folder. I'll double click that and you'll see that within that folder the breadcrumb trail is showing us here, within that folder, there are even more folders. There we also have the models folder. I'll double click the models folder and then we have even more folders. If I double click, for example, the nature props folder you'll see that within here we have six different meshes. We have, for example, a tree and I can see more data about the tree just by left clicking to select it, bring up his properties here in the object inspector and from the preview I can click and drag to rotate around the tree. Of course we can easily add that to the level just by dragging and dropping if I want to bring that into the scene, but I don't. So I'm going to grab the fir tree, right click and delete. So the first step is that here we can see that scattered across all of these folders we have a lot of assets, meshes, textures, sounds animation and even script files, which are programming files in the C sharp language that customize the behavior of a game. Now quite sensibly the creator of this FPS shooter game has divided the assets up across different folders to establish some organization into this project so we know where to find things if we need to look for them. However, even though this project has been organized into folders and that's great there's still additional organization that we could apply. First of all, if you want to create your own folders that's really easy to do all you need to do is move to the project panel, right click choose create, and then select folder from the menu and you can call this my custom folder and you can begin to drag and drop things into that folder to simply house them there. You'll see that the icon for this folder is a kind of dark field shape and that's just Unity's way of telling you that right now this folder is completely empty. Now it's really easy to drag and drop stuff around. You can simply reorganize things by grabbing, for example this file and dragging and dropping it into another folder. And Unity is smart enough to keep track of all the different places you might be reorganizing things so it's totally fine to take a mesh or a texture and to drag and drop that into a different folder it's not going to break your game. But in addition to simply housing things inside folders let's have a look at a different example and some additional features that Unity offers us for keeping track of our items. So I'm going to move to the mod assets folder that we've seen before go to the model's folder and you know, let's take a look at food props anything with the word food in it is good by me so I'm going to choose food. And we have a lot of delectable treats in this folder, cookies, doughnuts, gummy bears, licorice and of course the amazing lollypop. This is actually a mesh so we can drag and drop it in the scene to begin to add lollypops to our level and let's face it, who would want to do that. But I'm going to grab that lollypop, right click and choose delete. Here are some additional features that we can use within Unity to easily filter through the assets that we have to quickly find the assets you want. And some ways we can improve what's already here even in the first person shooter game. So if you want to find an asset by name you can easily move to the search field here at the top of the project panel and begin to type the name. Now, one of the food items that we saw was the gummy bear. So I can begin to type gummy and you'll see that Unity filters out a range of different assets where the name of that asset contains the word gummy. And I can do some similar things for other types of assets. For example, I can begin to find the donut and you can see here that it's identified the donut related objects that contain D-O-N in the title of those assets. But now let's say that I wanted to find a particular type of asset. Let's say that I only wanted to find a mesh as opposed to materials or textures or sounds. I can use a particular type of search query. I'm going to clear the search field and I'm going to type T colon T means type. And here I can choose the type of thing that I want to find. I can find all the meshes in the project by simply typing mesh T colon mesh and it will display all the meshes, that's great. I can also find all the textures if I want as well by changing mesh for texture. And I can do some similar things with other types of assets. T material will show me all of the materials, that's great. But let's say now, that I wanted to find all of those food assets that we saw inside the food folder. Well, if I type the word food it would only select the folder that contain them. And the only reason that it's selected the folder containing them is because that folder in its name contains the word food in food props. But we know that these meshes are all food related items. The reason they didn't show up in our search query was because their names don't contain the word food. So here inside Unity, we have some additional features that we can use to begin to isolate these items making them easier to find them when we need them. I'm going to select just one of the food items at least for the moment here. And you can see its properties here inside the inspector. I'm just going to shrink the window here because there's a feature right at the bottom right-hand side here that is a tag icon. I'm going to click that tag icon and a menu will appear outside of it this allows me to assign sticky tags to objects to tell you what kind of categories they're related to. So we have vegetation, vehicle and all kinds of other stuff here but we don't have the category food. Well, that's easy to fix. I can simply move to the search field at the top type in food there we are, select food and that now has been tagged with food. You can see that this appears as blue when this object is selected. Of course the other objects have not been tagged in this way, but I'm going to select the lollypop, hold down the shift key on the keyboard and select the donut to select all of these objects and then click the tag button and make sure they are all assigned the tag, food. Great. Now if I go back to the assets panel and I think I can resize the window now. I'm going to go back to the assets folder here and I'm going to search for the food tag. I'm going to click on the search field and I'm going to type L colon, L colon for label, and then search F-O-O-D for food. Notice here, it's selected all of the meshes that were related to food. It selected slightly more than that because it's selected these materials here too because these ended up getting tagged with food and the reason is because these meshes based on how they are set up, they depend on those assets. So they've been included in the food as well because they're intimately connected to those meshes. But everything that appears here in this search field is entirely related to food. We found the food related items for this project. So the great thing about Unity is that it allows us to isolate items not just on the basis of their name or their type, but we have this really neat tagging feature that allows us to apply various tags and we can associate many different tags with objects we can apply those tags to those objects to quickly and easily find them using the project panel. And we can really apply some organization to our assets. When you are working with objects and projects that go beyond the bare basics you will need to apply these principles of organization to everything you do otherwise it's going to drive you crazy and nobody wants that.

Contents