Class PixelPerfectCamera
The Pixel Perfect Camera component ensures your pixel art remains crisp and clear at different resolutions, and stable in motion.
Implements
Inherited Members
Namespace: UnityEngine.Experimental.Rendering.Universal
Assembly: Unity.RenderPipelines.Universal.2D.Runtime.dll
Syntax
[ExecuteInEditMode]
[DisallowMultipleComponent]
[AddComponentMenu("Rendering/2D/Pixel Perfect Camera")]
[RequireComponent(typeof(Camera))]
[MovedFrom(true, "UnityEngine.Experimental.Rendering.Universal", "Unity.RenderPipelines.Universal.Runtime", null)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest/index.html?subfolder=/manual/2d-pixelperfect.html%23properties")]
public class PixelPerfectCamera : MonoBehaviour, ISerializationCallbackReceiver
Properties
| Name | Description |
|---|---|
| assetsPPU | Match this value to to the Pixels Per Unit values of all Sprites within the Scene. |
| cropFrame | Defines how the output display will be cropped. |
| gridSnapping | Defines if pixels will be locked to a grid determined by assetsPPU. |
| orthographicSize | The target orthographic size of the camera. |
| pixelRatio | Ratio of the rendered Sprites compared to their original size (readonly). |
| refResolutionX | The original horizontal resolution your Assets are designed for. |
| refResolutionY | Original vertical resolution your Assets are designed for. |
| requiresUpscalePass | Returns if an upscale pass is required. |
Methods
| Name | Description |
|---|---|
| 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. |
| OnAfterDeserialize() | OnAfterSerialize implementation. |
| OnBeforeSerialize() | OnBeforeSerialize implementation. |
| RoundToPixel(Vector3) | Round a arbitrary position to an integer pixel position. Works in world space. |