I don't understand pixels per unit :(

I really don’t get the pixels per unit thing. And furthermore, I don’t get why we ended up putting the background in the bottom left corner when we could have simply made it full the whole screen.

Also, does the course cover later on, how we should deal with different screen sizes so an iPhone user for example wouldn’t be at a disadvantage compared to an iPad user?

2 Likes

From my understanding,
The unity workspace is divided in World unities, so pixel per unity is the the size that the texture or image will have inside the unity’s world, for example: if you have an image with 1600x900 px and set it to 100 pixels per unity, you will have an image that will be 16x9 wide. And 16x9 will be the number of reference that everything within the scene will use, it’s transform.position.

1 Like

It does explain regarding different screen sizes later on glitch garden classes

Hi guys,

I want to add another question about this; anyone knows how does Ben know beforehand that the playing space will be 16 blocks wide? I think that is not explained in the example, and that part have impact in the next videos, especially when you have to check the other sprites and when you have to calculate the paddle position… Thanks in advance! Cheers

PD: My english sucks, so I apologize for any grammar issues xD

1 Like

In one of the early Block Breaker lectures Ben mentions about screen resolution for an iPad Air, it has a screen width of 2,048 pixels. Additionally, if you check the slides (under resources) you will see it mentions that some research is done on the number of block typically in an Arkanoid-esq game, varying between 14 and 16 typically.

Ben chose to use 16 blocks. The pixels per world space unit was then calculated as;

2,048 / 16 = 128

Hope this helps.

1 Like

Thanks Rob! So basically he picks some kind of “standard” for the 16 blocks wide… Thanks again!

1 Like

I believe so yes.

You could change it, you could maybe have less blocks, more blocks, smaller blocks etc… you’d just need to change a few of the bits of code as you go through.