Game Development Reference
In-Depth Information
Unity 4.3 now has the texture type of
Sprite
. You can find this by selecting the
Platform
texture file in the
Project
tab and looking over at the inspector. With the
project in 2D defaults, it will automatically import textures in
Sprite
mode—which
you can see at the top of the inspector. Most of these options will already be set
properly, but let's change the texture
Max Size
to
512
and
Format
to
16 bits
. A size of
512 makes sure that Unity recognizes the image as anything up to 512 x 512 before it
resizes it to something smaller.
16 bits
makes sure it's an uncompressed image which
allows trillions of possible colors. That's kind of an overkill in most cases for classic
2D sprites; however, many modern sprites share similarities with modern high-
resolution textures for 3D games. Unity also doesn't have a setting for 8-bit imagery,
so 16-bit is a great setting to use! Compression? That tries to literally compress the
image to take up less space, at the penalty of a lower quality image. In most cases,
you won't want a compressed image. However, it will have its uses. Now, if you
wanted your art to look more pixelated, set
Filter Mode
to
Point
. Otherwise, give
Bilinear
or
Trilinear
filtering a shot to add some excellent smoothing to the visuals.
The following screenshot shows what the import settings should look like for your
sprite platform:
When creating images for a 2D game in Unity or any modern game engine, be
careful not to use true gradients. You can use gradients, but the image map will need
to have its format set to
Truecolor
to look proper. Otherwise, the gradient will look
like a set of hard-colored segments. While the
Truecolor
property allows the image
to render properly, it takes up more space in video memory.
To get this platform into your scene, simply drag the platform image from the
Project
tab and drop it into the
Scene
tab or the
Hierarchy
tab. It auto-magically
appears within the scene. Make sure its position in the scene is
X: 0, Y: 0, Z: 0
and its scale is
X: 1, Y: 1, Z: 1
.