Subtitles section Play video
Textures.
A texture is an image file.
Unity uses textures in a number of different ways.
The most common use of a texture is when
applied to a material in the base
texture property to give a mesh a
textured surface.
For more information on materials
see the appropriate lesson.
Textures can also be used for
GUI elements applied to additional
material properties to act as normal
maps, specular maps or height maps.
Used as custom cursors, icons,
splash screens and more.
Textures can be any image file
supported by Unity.
These can be photos straight from a
digital source, but textures are usually
images created or manipulated in an image
editor, like Photoshop or Gimp.
It is important to note that the layered
files will be flattened on import
but the layers are maintained in
Unity in the original file.
This means we can turn layers on and off
without loss when we're setting up our game
but when we're running our game we will not
have access to these layers individually.
Most of the image file formats used by
Unity support transparency.
The notable exception is JPEG,
which does not.
For more information on transparency
and how to use it, see the documentation on
materials and shaders.
Texture files should be saved in the assets folder.
Unity searches the assets folder
in a specific order when seeking materials.
For more information on searching for textures
and seeking materials see the lesson
on mesh importing.
A texture file should be assigned import
settings in the texture importer.
Texture Type property contains a
list of presets.
These limit the number of editable properties
available in the texture importer
based on the intended use for the image.
The default is Texture.
Advanced will expose all of the available
properties in the texture importer.
The other presets, including advanced,
will be covered in another lesson.
If we need to set the transparency
or alpha channel for the texture automatically
based on the light and dark parts of the image
we can check the Alpha From Greyscale field.
Black will be completely transparent,
white will be completely opaque.
Wrap Mode controls how the texture is mapped
on to a renderer when tiled.
This setting works for both 2D elements
and 3D meshes.
Repeat will repeat the texture and
and Clamp will stretch the edges of the texture.
Filter Mode controls how the graphics
card renders the texture,
when it is stretched by 3D transformations.
These are effectively quality settings,
trilinear being the best and
point being the most basic.
Aniso level controls the quality of
textures when rendered at steep angles.
Anisotropic Filtering increases the
texture quality when viewed at
a grazing angle.
This has an increased rendering cost when applied.
In quality settings, Anisotropic filtering
can be forced on for all textures
or disabled completely.
For more information on quality settings
see the appropriate lesson.
Because Unity supports building to
multiple target platforms from one project
the texture importer allows for a default
setting for max texture size
and compression format that can be
overridden on a per platform basis.
Max Size will set the maximum size for
for the imported texture.
If max size is set to a value larger
than that of the original image the size
of the imported texture
will be that of the original.
This setting will not make the texture
larger than the original image.
If max size is set to a value less
than the original image the texture will
be resized to that value on import.
Like layers, however, the original
file is unchanged.
Only the imported asset will be adjusted.
Format sets the compression technique.
The default settings are relatively simple
when using the Texture preset.
These are effectively quality settings of
low, medium and high.
More control can be set on a per
platform basis, or when using the Advanced setting.
Each target platform can have it's own settings
that override the default values.
Max size and compression can be adjusted
for each target platform.
This means we can set the target sizes
and compression appropriate for the
bandwidth and processing power
of the target platform.
When the build target is changed these
assets will be reimported using the
overridden values.
This section works in conjunction with Build Settings.
For more information on Build Settings
please see the appropriate lesson.
At the bottom of the importer is a preview window.
When the preview window is open we can
view the changes we have made.
We will need to apply our settings before
the preview window will update it's display.
The preview window will display the image
being imported and report basic information
about the imported texture, including
the size of the imported texture,
the compression setting and the footprint
of the texture in our game.