Legacy Documentation: Version 2018.1 (Go to current version)
Texture Components
Importing Textures
Other Versions

Textures

Switch to Scripting

Textures are image or movie files that lay over or wrap around your GameObjects to give them a visual effect. This page details the properties you need to manage for your Textures.

Unity recognises any image or movie file in a 3D project’s Assets folder as a Texture (in 2D projects, they are saved as Sprites). As long as the image meets the size requirements specified below, it is imported and optimized for game use (although any Shaders you use for your GameObjects have specific Texture requirements). This extends to multi-layer Photoshop or TIFF files, which are automatically flattened on import so that there is no size penalty for your game. This flattening happens internally to Unity, not to the PSD file itself, and is optional, so you can continue to save and import your PSD files with layers intact.

Properties

The Texture Inspector window
The Texture Inspector window

The Inspector window is split into two sections: the Texture Importer above, and the Preview below.

Texture Importer

The Texture Importer defines how images are imported from your project’s Assets folder into the Unity Editor. To access the Texture Importer, select the image file in the Project window. The Texture Importer opens in the Inspector window.

Note that some of the less commonly used properties are hidden by default. Click Advanced in the Inspector window to view these.

The first property in the Texture Importer is the Texture Type. Use this to select the type of Texture you want to create from the source image file. See documentation on Texture types for more information on each type.

Property: Function:
Texture Type Use this to define what your Texture is to be used for. The other properties in the Texture Importer change depending on which one you choose.
    Default This is the most common setting used for all Textures. It provides access to most of the properties for Texture importing.
    Normal Map Select this to turn the color channels into a format suitable for real-time normal mapping. See Importing Textures for more information on normal mapping.
    Editor GUI Select this if you are using the Texture on any HUD or GUI controls.
    Sprite (2D and UI) Select this if you are using the Texture in a 2D game as a Sprite.
    Cursor Select this if you are using the Texture as a custom cursor.
    Cookie Select this to set your Texture up with the basic parameters used for the Cookies of your Scene’s Lights.
    Lightmap Select this if you are using the Texture as a Lightmap. This option enables encoding into a specific format (RGBM or dLDR, depending on the platform) and a post-processing step on Texture data (a push-pull dilation pass).
    Single Channel Select this if you only need one channel in the Texture.

The second property in the Texture Importer is the Texture Shape. Use this to select and define the shape and structure of the Texture.

Property: Function:
Texture Shape Use this to define the shape of the Texture. This is set to 2D by default.
    2D This is the most common setting for all Textures; it defines the image file as a 2D Texture. These are used to map textures to 3D meshes and GUI elements, among other project elements.
    Cube This defines the Texture as a cubemap. You could use this for Skyboxes or Reflection Probes, for example. Selecting Cube displays different mapping options.
Mapping This setting is only available when Texture Shape is set to Cube. Use Mapping to specify how the Texture is projected onto your GameObject. This is set to Auto by default.
    Auto Unity tries to automatically work out the layout from the Texture information.
    6 Frames Layout (Cubic Environment) The Texture contains six images arranged in one of the standard cubemap layouts: cross, or sequence (+x -x +y -y +z -z). The images can be orientated either horizontally or vertically.
    Latitude Longitude (Cylindrical) Maps the Texture to a 2D Latitude-Longitude representation.
    Mirrored Ball (Sphere Mapped) Maps the Texture to a sphere-like cubemap.
Convolution Type Choose the type of pre-convolution (that is, filtering) that you want to use for this texture. The result of pre-convolution is stored in mips. This is set to None by default.
    None The Texture has no pre-convolution (no filtering).
    Specular (Glossy Reflection) Select this to use cubemaps as Reflection Probes. The Texture mip maps are pre-convoluted (filtered) with the engine BRDF. (See Wikipedia’s page on Bidirectional reflectance distribution function for more information.)
    Diffuse (Irradiance) The Texture is convoluted (filtered) to represent irradiance. This is useful if you use the cubemap as a Light Probe.
Fixup Edge Seams This option is only available with the None or Diffuse convolution (filter). Use this on low-end platforms as a work-around for filtering limitations, such as cubemaps incorrectly filtered between faces.

Platform-specific overrides

The Texture Inspector window has a Platform-specific overrides panel.

Platform-specific overrides panel
Platform-specific overrides panel

When building for different platforms, you need to think about the resolution, the file size with associated memory size requirements, the pixel dimensions, and the quality of your Textures for each target platform. Use the Platform-specific overrides panel to set default options (using Default), and then override them for a specific platform using the buttons along the top of the panel.

Property: Function:
Max Size The maximum imported Texture dimensions in pixels. Artists often prefer to work with huge dimension-size Textures; use Max Size to scale the Texture down to a suitable dimension-size.
Compression Choose the compression type for the Texture. This parameter helps the system choose the right compression format for a Texture. Depending on the platform and the availability of compression formats, different settings might end up with the same internal format (for example, Low Quality Compression has an effect on mobile platforms, but not on desktop platforms).
    None The Texture is not compressed.
    Low Quality The Texture is compressed in a low-quality format. This results in a lower memory usage compared with Normal Quality.
    Normal Quality The Texture is compressed with a standard format.
    High Quality The Texture is compressed in a high-quality format. This results in a higher memory usage compared with Normal Quality.
Format This bypasses the automatic system to specify what internal representation is used for the Texture. The list of available formats depends on the platform and Texture type. See documentation on Texture formats for platform-specific overrides for more information.
Note: Even when a platform is not overridden, this option shows the format chosen by the automatic system. The Format property is only available when overriding for a specific platform, and not as a default setting.
Use crunch compression Use crunch compression, if applicable. Crunch is a lossy compression format on top of DXT or ETC Texture compression. Textures are decompressed to DXT or ETC on the CPU and then uploaded on the GPU at runtime. Crunch compression helps the Texture use the lowest possible amount of space on disk and for downloads. Crunch Textures can take a long time to compress, but decompression at runtime is very fast.
Compressor Quality When using Crunch Texture compression, use the slider to adjust the quality. A higher compression quality means larger Textures and longer compression times.

  • 2017–09–18 Page amended with limited editorial review

  • Crunch compression format updated in 2017.3 NewIn20173

对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答