Version: 2020.3
LanguageEnglish
  • C#

PixelPerfectRendering.pixelSnapSpacing

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static float pixelSnapSpacing;

Description

To achieve a pixel perfect render, Sprites must be displaced to discrete positions at render time. This value defines the minimum distance between these positions. This doesn’t affect the GameObject's transform position.

By default, a Sprite can be moved freely along all axes of the world space. By setting this property to a non-zero positive value, Sprite movement will always appear displaced to multiples of this value at render time.

For a pixel perfect render, this value should be set to the size of a single on-screen pixel. Calculate this value with Camera.orthographicSize * 2.0 / Camera.pixelHeight , when viewing the world space through the Orthographic Camera.

This property is to be used together with the PixelPerfectCamera component for complete configuration of pixel perfect rendering.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961