Sprite size should be 128, but is 113

I’ve split an image, using grid by cell size. I used size 128x128.

For the sprite sheet I’ve put Pixels per unit to 128 and it works well to paint using the Tile Palette, in which I’ve dragged and dropped the sliced sprite sheet.

The weird thing is, usually when I click one of the sliced sprites, they show up in the Inspector with size in pixels, and these sprites are shown having size 113x113.

Why is this?

Here’s an image:

pixels per unit is not the resolution of your sprites

what if your sprite was a rectangle? would you expect it to be 128x128 aswel?

No, I expect it to be 128x128 since I used grid by cell size = 128x128.

And since I’ve used pixels by unit 128x128 and the sprites fit perfectly into my tile map I assumed that they, indeed, have the size 128x128.

pixel resolution = the size of your sprites, created by you in a given graphics program (photoshop)

pixels per unit = how many pixels should fit inside 1 unity coordinate

I know that, you’re not understanding what my question is. Anyone else, with experience of slicing with grid by cell size?

here i put your question on chatgpt:

The reason why the sliced sprites are appearing as 113x113 pixels in the inspector even though you’ve sliced them at 128x128 pixels is because of the way Unity calculates the size of sprites.

When you set the Pixels per unit to 128, Unity assumes that each unit in your game world is equivalent to 128 pixels in your sprite sheet. This means that if you slice your sprite sheet into 128x128 pixel cells, each cell will be treated as a single unit in Unity.

However, when you click on a sliced sprite in the inspector, Unity displays its size in pixels based on the dimensions of the sprite itself, not based on the size of the original image or the number of units in your game world.

In other words, the sliced sprites in the inspector are being displayed as 113x113 pixels because that is the actual size of each sliced sprite in your sprite sheet, after taking into account any empty space around the edges of the image.

This can happen if your original image wasn’t perfectly aligned with the grid, or if there was any transparent padding around the edges of each cell.

So, the important thing to remember is that the size of your sliced sprites in the inspector is based on their actual dimensions, not on the size of the original image or the number of units in your game world.