0
\$\begingroup\$

If I'm not wrong, those are steps to use tiles with Tilemap in Unity

  1. Upload sprites to Unity
  2. Create a palette.
  3. Upload sprites to the palette to create tiles.

I need some static images to use with the Tilemap. No animation. Can I use just any png. images (during the step 1) for that and follow those 3 steps? Or it's necesary to use first some programs to make "sprites" out of those images?

Here I'm trying to put some tiles in 4 cells of the Tilemap. The screenshot with number 10 is what I get with my custom image. It's way bigger than the 4 cells. And the second screenshot - this is what it should look like, it has 4 images, each in its cell. I made it from an image found in a tutorial on YouTube. So I guess the problem is the source image.

This is what I get with the image that's used in a tutorial on YouTube. It works like it has to - 4 images in a square of 4 cells of the Tilemap

This is what I get with my image

\$\endgroup\$
6
  • 2
    \$\begingroup\$ When you try to follow these steps with the png images you have, did something go wrong? Where did you get stuck trying to apply these three steps with "normal" images? \$\endgroup\$
    – DMGregory
    Dec 5, 2022 at 3:22
  • \$\begingroup\$ @DMGregory I've added 2 screenshots. Tiles made of my images turn out to be way bigger than the tile that surely works. Although I put the same Pixel Per Unit and Max Size in settings \$\endgroup\$
    – kozavr
    Dec 5, 2022 at 8:02
  • \$\begingroup\$ Can you edit your question to add a proper problem description using words? Images alone are often not as self-explanatory as you think. \$\endgroup\$
    – Philipp
    Dec 5, 2022 at 8:24
  • 1
    \$\begingroup\$ Although I put the same Pixel Per Unit and Max Size in settings. Are the images as well the same size when you import them? A 40x40 image with 40PPU is not displayed the same as a 400x400 image with 40PPU. That is the benefit of the sprites if they are all in one image. They are all uniform sized and you dont have to check each file individual \$\endgroup\$
    – Zibelas
    Dec 5, 2022 at 9:54
  • 1
    \$\begingroup\$ You did not show us the import settings for these misbehaving images, including the top of the inspector showing the import type, and the bottom of the inspector showing the image preview with the resolution listed. \$\endgroup\$
    – DMGregory
    Dec 5, 2022 at 11:18

1 Answer 1

1
\$\begingroup\$

Go to the import settings of your image asset and change the "pixels per unit" to 10 times the value it has now.

The tilemap does not automatically adjust the size of tile images so they fit into the grid. And just like any Unity component, it works with logical Unity units, not with screen pixels. So you need to make sure the images you use for your tilemap have the correct ratio of pixels per unit.

Alternatively, you can adjust your camera size and grid size so that one unit on the screen is indeed the same as the default PPU of newly imported images (60 pixels).

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .