Manually Set Sprite pixelsPerUnit

Hi Guys

I’m making a grid for a tiled scenario, the problem is that i’m loading all my textures from code, and creating sprites in runtime. It seems like unity is making it with a pixels per unity of 100.

i would need to set it to 1, because when i try to order them, if i multiply per width and heigth, my grid get all spreaded out one tile faaaar away from the next :frowning:

Hi,

Sprite.Create has a pixelstounits argument. Set that to whatever you need.
However it should not matter what your value is, you should still be able to grid tile your sprites.

Cool! Thanks!

now i have two solution to this.
What i was doing was separate my sprites by the texture.width, but because the pixeltounits it was being al tiled one apart from another, the solution was only to do a texture.widtg / pixeltounits.

Cheers!