Sprite Factory

ReadMe
Release Notes
Overview
Using the Editor
Upgrading

Concepts
Sprites
Master Sprites
Sprite Groups
Colliders
Locators
Material Sets
SpriteUpdater
SpriteCamera

Advanced
Working in Multiple Projects

Classes
Runtime Classes

Videos
Overview
Creating Sprites
Sprite Inspector
Frame Events
Collision System
Locator System
Material Sets

Links
Sprite Factory Site
Web Documentation
Support
Contact

SpriteFactory.Sprite.scaleToActualPixelSize

C#: bool scaleToActualPixelSize
JS: var scaleToActualPixelSize : boolean

Description
Scale Sprite so that 1 texel equals 1 screen pixel as viewed by the main camera in the scene. The camera must be set to orthographic mode for this to work.

This value should be set in the inspector before gameplay begins. If you need to scale the sprite to actual pixel size during gameplay via scripting, it's recommended to call ScaleToActualPixelSize instead. (The reason is that changes to scaleToActualPixelSize may take place 1 frame after being set, whereas the ScaleToActualPixelSize function takes place immediately.)

* IMPORTANT *
This actually scales the Sprite's transform in order to match the pixel size. This could have a number of potentially unwanted side effects because while the Sprite scales, things such as movement speeds and distances to other objects does not. If your intention is to display all the Sprites on the screen at actual pixel size, you do not want to use this setting. Instead, you should add a SpriteCamera to the scene and use this camera for rendering.

See Also
ScaleToActualPixelSize