Displaying sprites (images)

Page update date :
Page creation date :

Verification environment

  • Windows 11
Unity Hub
  • 3.1.1
Unity Editor
  • 2020.3.25f1

About displaying 2D images (sprites)

In Unity, it's very easy to just display an image because you don't need to write a script, it's done in the editor.

There are several types of images that can be used, but I think that the "PNG" format, which can be "degraded" and "compressed" and can be handled by many applications, is easy to handle. Of course, you can use other forms of images to match your game.

Preparing the image file

An image file is required to display the image in the game. It can be in any format that can be used in Unity. The following images are used in this tip.

Create a project

In this case, we will use a 2D template because we will display a 2D image. How to create a project is explained in a separate tip, so I won't go into details.

Add an image to your project

There are several ways to do this, but the quickest way is to add an image file by dragging it into your project.

Placement of sprites (images)

Again, you can simply drag it from the project to the view.

What is in the project is a so-called material, so you can place as many as you want. To display it, simply drag the image again.

The inspector displays information about the selected image. It is possible to set various settings such as rotation and scale.

Run the game and see if the sprite appears.

It is only displayed on the editor, but of course it can be displayed on the target device if it is output as a game.