Class PixelPerfectCamera
The Pixel Perfect Camera component ensures your pixel art remains crisp and clear at different resolutions, and stable in motion.
상속된 멤버
네임스페이스: UnityEngine.Experimental.Rendering.Universal
어셈블리: solution.dll
구문
[DisallowMultipleComponent]
[AddComponentMenu("Rendering/2D/Pixel Perfect Camera (Experimental)")]
[RequireComponent(typeof(Camera))]
[MovedFrom("UnityEngine.Experimental.Rendering.LWRP")]
public class PixelPerfectCamera : MonoBehaviour
프로퍼티
| 이름 | 설명 |
|---|---|
| assetsPPU | Match this value to to the Pixels Per Unit values of all Sprites within the Scene. |
| cropFrameX | Set to true to crop the viewport with black bars to match refResolutionX in the horizontal direction. |
| cropFrameY | Set to true to crop the viewport with black bars to match refResolutionY in the vertical direction. |
| pixelRatio | Ratio of the rendered Sprites compared to their original size (readonly). |
| pixelSnapping | Set to true to prevent subpixel movement and make Sprites appear to move in pixel-by-pixel increments. Only applicable when upscaleRT is false. |
| refResolutionX | The original horizontal resolution your Assets are designed for. |
| refResolutionY | Original vertical resolution your Assets are designed for. |
| stretchFill | Set to true to expand the viewport to fit the screen resolution while maintaining the viewport's aspect ratio. Only applicable when both cropFrameX and cropFrameY are true. |
| upscaleRT | Set to true to have the Scene rendered to a temporary texture set as close as possible to the Reference Resolution, while maintaining the full screen aspect ratio. This temporary texture is then upscaled to fit the full screen. |
메서드
| 이름 | 설명 |
|---|---|
| CorrectCinemachineOrthoSize(float) | Find a pixel-perfect orthographic size as close to targetOrthoSize as possible. Used by Cinemachine to solve compatibility issues with Pixel Perfect Camera. |
| RoundToPixel(Vector3) | Round a arbitrary position to an integer pixel position. Works in world space. |