Importing assets

In this chapter, we are going to create an interior environment. This will be useful to know, because unlike a landscape, interiors are generally more structured than the outside world, with straight floors and walls where we can use 3D models modularly to build the environment!

To show how easy it is to use, let's get started. Perform the following steps:

  1. From the Project tab, create a new folder named Materials. Then, enter the folder and create two new materials by selecting Create | New Material. Give one of the new materials the name House and the other, Props. Once you have created that go to your example code folder, and within the Textures folder, import the 2048_House_TEX.jpg and 2048_Props_TEX.jpg files from the Example Code Assets folder for this chapter. Once you've done that, apply that texture to the materials in the Albedo property via drag and drop. Once finished, it should look like the following screenshot:
    Importing assets
  2. Create a new folder from the Project tab named Models.

    John Espiritu has very kindly provided some models in modular pieces for us to work with. So, the next thing we will do is actually import those models.

    Note

    For more info on John's stuff or to commission him yourself, check out http://raynehaize.tumblr.com/ or http://raynehaize.deviantart.com/.

  3. With the Models folder selected, let's import the models by dragging and dropping the Modular Pieces and Props folders in it. Take a look at the following screenshot:
    Importing assets
  4. Back in Unity, move to the Modular Pieces folder in Hierarchy. At this point, it should look somewhat as follows:
    Importing assets
  5. By default, Unity attempts to do some things automatically for us, which creates a lot of stuff we don't need for simple environment pieces like this. Select all the objects in this folder by selecting the Ceiling 01 object, hold down the Shift key, and select the Wall Plain object at the bottom. This will bring you to Model Importer. Once you are in the Inspector tab, you will see the following three tabs:
  6. Inside the Model tab, change Scale Factor to 2.5.

    The Scale Factor property allows you to apply a scalar to the model that you've imported. This is fine for this project, but generally, when working with animations, changing the scale factor may hurt your rig. So, be sure that you have your artist create art at the correct scale.

  7. Next, uncheck the Import Models option from the Materials section. After this, click on the Apply button.

    If left checked, Unity will have each object use its own material, which is intended to have its own texture. All of our pieces use the same texture, so there's no need to have multiple textures.

  8. Select the Rig tab, and confirm the Animation Type is None, and click on Apply if needed.

    If the object has animation, it will attempt to add an Avatar and more, which is unnecessary for this. Note that now the Animations tab will be grayed out because we have no animations.

  9. Delete the Materials folder inside the Modular Pieces folder.

    Note

    When exporting an FBX file, it exports your model with UV coordinates but doesn't include the textures in the FBX file. You have to import your textures separately into Unity and add it to the material generated or assign it on your own.

    As of this version of Unity, there is no way to have models not generate a material by default, hence we need to delete them. We will add materials to these models when we create their prefabs.

  10. Repeat steps 5–8 with the Props folder as well. Once you finish, the folder should look like the following screenshot:
    Importing assets

Now, we have our models in the project! This is a great first step, but it's useless unless the models are actually in the game world. Let's get started with that now.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset