What you will learn
In this Unity tutorial, we will learn how to effectively utilize the game engine. Over the tutorial, we will learn how to use the Unity editor interface as well as how to navigate in the scene view. From there, we will learn how to import assets and how to create prefabs. Then we will shape our level even more by adding character controllers, colliders, lights, materials and physics. We will then finish the tutorial by learning how to use scripting in order to make our level interactive.
In this lesson, we're going to talk about importing packages to make our asset creation a lot faster. So what we're going to do is, we pulled up the final level that we have previously built. And what I want to do is actually show you how we can use a workflow of mixing assets from previous projects. So let's say you've created one level and you've completed it. And you're ready to start on a new level. And you want to use some assets that you built and put together in Unity in a previous level and you want to bring them into this new one. So for example, I have things like these piles of paper that I've built up here. And I don't necessarily want to go through and duplicating all these and placing them around again. So what I want to do is just select a group of these. And then what I'm going to do is create them into a pre-fab and then import that pre-fab into my new level that we're creating here. So with that said, let's go ahead and try this out. So first thing I'm going to do is basically parent these together. So in my hierarchy, I've got those three selected. And I'm going to click and drag this one up on top of one of my other pieces of paper here. And it's going to say, I'm going to lose my pre-fab. But that's OK. And I'm going to hit continue. And there we go. Now it's finally going through there. And what it did is it created a pre-fab for all three of those. So now what I'm going to do is actually put that into a pre-fab that I've already created. So if you're not sure how to do that, if you can't remember, all you need to do is just right click on the Pre-fabs folder, Create and Pre-fab. And that will allow you to create an empty pre-fab or you can rename it. So let's take our parented piles of paper here. And let's drag that right over the top of paper pile. And now we've got a pre-fab of that. Now what I want to do now is actually export this as a unity package. We're going to go to Assets, Export Package. Now once this comes up, it's going to go ahead and check everything that is in my project folder. And I just want one specific thing. So I'm going to check none, so that way it deselects everything. And I'm going to scroll down to my Assets, Pre-Fabs folder. So let's take some time and try to find that there. I've got quite a few meshes. So I just want to make sure I get the right one. So we're looking for Paper Pile. And there it is right there. So let's just check that one. And now we're going to hit Export. Now we want to include any dependencies that is with this. So we want to make sure that those children come along and also the material. So let's export this. And let's call this Paper Pile. So now this is going to make a package right in my original folder, here in my original project folder. So that's OK with me. So I'm just going to hit save. And you'll notice that it brings up a window showing me where this is saved. So this has been saved in my Digital Tutors folder, my original in our finished level. So I'm going to close this window. And I'm going to open up our project that we've been working on. So I'm going to go to File, Open Project. And we're going to do our C drive Unity project. And I don't necessarily want to save anything in this final. So I'm going to hit Don't Save. And it's going to restart Unity, so no big issue there. And now let's load our latest lesson. So I'm going to Lesson Scenes and load in Lesson 15. So here's where we left off in our last lesson. And we talked about speeding up the process by importing some packages that we've already created. So let's import that package. Let's go to Assets, Import Package. Now we want to do Custom Package. All of these are the original packages that we've seen at the very first lesson whenever we created a brand new project. So let's do Custom Package. And what we're going to do is we're going to navigate to the folder that holds our Unity project. So we're going to go to My Documents, because that's where I created it. And there's my Digital Tutors. So here's my paper_pile.unitypackage. And I'm going to hit Open And it's going to bring up a window here saying Importing Package. So let's make sure that this is correct. And we're going to hit Import. So now whenever this imports here, let's go ahead and go to our pre-fabs folder, and there is Paper Pile right there. So now what I've done is I can actually create some objects here. Now let's drag this into our seam, to make sure that this is showing up correctly. And you'll notice that there's not anything on my object. And that's because this is actually missing the mesh. So let's click on this little option here. And let's find the paper pile mesh. So let's just scroll down here. I think it's called "paper debris." And give me just one moment here. Let's find this. OK so here it is. It's called the plane004. I couldn't actually see the objects in there. It's turned on its side. So we're going to choose that mesh to re-associate this paper pile here. So let's close that. And you'll notice that we're only getting one part of this pile. So we need to associate the children as well. So we're going to go to this missing mesh. And we'll go down to plane004 and reapply that. So now we're seeing these come into view. So let's do this one more time. Here we go. And now you'll notice that we have this pink material on it. And really what this means is, it's saying that it used to have a material, but now it's no longer there. So it's asking, all right what's going on here? Where is my material? So what we want to do is find our material for this. So we're going to open up our meshes. And we're going to go to the Props folder. And I'll go to my Materials. And in here we should see Paper Material. Now the paper material doesn't have a texture on it. So let's select that texture. And what we have is called a document text. Close that. And then let's just drag this right on top of our pieces of paper here. So we'll continue to do that for these three. And there we go. Now we have this pile of paper here. And what we've done is successfully just brought in a package. Now this may have been a lot of steps to bring in this specific package. But sometimes it could be even more tedious than this. We may have a lot of objects that we need to bring in. So this is really helpful to just bring in packages that way. So this was just one example that you could use the importing and exporting packages. So let's put this paper here on the ground here. And we can start dressing this up. We could add some more piles of paper throughout this hallway. But, you know what? I'm going to let you do that in between the lessons and just dress it up however you want. Just add as many details as you want. And what we're going to do in our next lesson is we're going to work on this room in here. And we're going to start by giving the pods their materials. And then we're going to start adding some colliders to this object. So what we're going to do in our next lesson, mainly, is just adding some colliders.