Game Development Reference
In-Depth Information
23 void LateUpdate ()
24 {
25 //Update orthographic size
26 Cam.orthographicSize = Screen.height / 2f /
PixelsToWorldUnits;
27 }
28 //-------------------------------------------------------
29 }
30 //-------------------------------------------------------
Notice that the member variable PixelsToWorldUnits has been added to line
13 to scale the orthographic size according to the Pixels To Units field of imported
sprite textures, as shown in the following screenshot. This helps ensure that sprites
will appear in their correct pixel sizes when shown on screen. This is so because all
sprites are necessarily scaled by this value to map pixels in the texture to units in
the world.
Setting the Pixels to Units scale for sprite textures
 
Search WWH ::




Custom Search