Pixels To Units

The Pixels To Units value lets you set the scale of the sprite in relation to the units in Unity. Setting this to more closely match the dimensions of your sprites will give you a more accurate resolution. This will also allow us to use Unity’s tool to create our levels more quickly and with more ease. We will go into creating our environments in the next chapter. For now, let’s explain Pixels To Units a little more.

In Figure 3.3 we can see that the Pixels To Units value is set at 100. This says that every 100 pixels will be equivalent to 1 unit in Unity. Our Player GameObject is roughly 92 pixels tall. We can check this by looking at the single sprites for our p1 character in the Project Browser, or by opening our p1_spritesheet ...

Get Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.