Importing textures and setting them to Inspector

Importing textures into a Unity project is a fundamental activity, and you will perform it several times. The following recipe explains two ways to import textures into Unity and how to configure them for the materials of your 3D models.

Getting ready

For this recipe, you need any square texture that you may already have, or use the one we provide. Anything will do, even a simple, checker texture; there are many available online. We use the following image for this recipe:

Getting ready

How to do it...

To import a texture in Unity, we begin with opening it into a 2D editor:

  1. Open a PSD texture with Photoshop, or the alternative BMP file with any software you like. If you don't have the required software, you can download XnView, which can read PSD files. It is available at http://www.xnview.com/.
  2. Name the file. We picked the name firstTexture.
  3. Select the Assets/Textures destination folder in your Unity project.
  4. Save the file. You can either leave it in its PSD original format or change it into a PNG file. The following screenshot shows how to perform the operation of saving the image as a PSD file:
    How to do it...
  5. The following screenshot, on the other hand, shows how to save it as a PNG file instead:
    How to do it...
  6. Now launch Unity. From the project panel, select our firstTexture PSD file.
  7. Access Inspector and check that it is set as shown in the following image:
    How to do it...
  8. Click on the Apply button to end this process. The following image shows how the texture preview should look:
    How to do it...

How it works...

Unity allows several texture types to be configured, depending on the use you expect to make of textures for your project. For this recipe, we configured a simple diffuse texture. In the next recipe, we will show you how to deal with transparent textures instead.

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

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