docs.unity3d.com
    Show / Hide Table of Contents

    Class PixelPerfectCamera

    The Pixel Perfect Camera component ensures your pixel art remains crisp and clear at different resolutions, and stable in motion.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    PixelPerfectCamera
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    UnityEngine.Component.GetComponentInParent(System.Type, System.Boolean)
    Component.GetComponentInParent(Type)
    UnityEngine.Component.GetComponentInParent<T>(System.Boolean)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(String)
    Component.SendMessageUpwards(String, Object, SendMessageOptions)
    Component.SendMessageUpwards(String, Object)
    Component.SendMessageUpwards(String)
    Component.SendMessageUpwards(String, SendMessageOptions)
    Component.SendMessage(String, Object)
    Component.SendMessage(String)
    Component.SendMessage(String, Object, SendMessageOptions)
    Component.SendMessage(String, SendMessageOptions)
    Component.BroadcastMessage(String, Object, SendMessageOptions)
    Component.BroadcastMessage(String, Object)
    Component.BroadcastMessage(String)
    Component.BroadcastMessage(String, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, Boolean)
    Object.DontDestroyOnLoad(Object)
    Object.FindObjectsOfType<T>()
    UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
    Object.FindObjectOfType<T>()
    UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
    Object.FindObjectOfType(Type)
    Object.FindObjectOfType(Type, Boolean)
    Object.ToString()
    Object.name
    Object.hideFlags
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.Experimental.Rendering.Universal
    Syntax
    [ExecuteInEditMode]
    [DisallowMultipleComponent]
    [AddComponentMenu("Rendering/2D/Pixel Perfect Camera")]
    [RequireComponent(typeof(Camera))]
    [MovedFrom("UnityEngine.Experimental.Rendering")]
    [HelpURL("https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest/index.html?subfolder=/manual/2d-pixelperfect.html%23properties")]
    public class PixelPerfectCamera : MonoBehaviour, IPixelPerfectCamera, ISerializationCallbackReceiver

    Properties

    assetsPPU

    Match this value to to the Pixels Per Unit values of all Sprites within the Scene.

    Declaration
    public int assetsPPU { get; set; }
    Property Value
    Type Description
    Int32

    cropFrame

    Declaration
    public PixelPerfectCamera.CropFrame cropFrame { get; set; }
    Property Value
    Type Description
    PixelPerfectCamera.CropFrame

    gridSnapping

    Declaration
    public PixelPerfectCamera.GridSnapping gridSnapping { get; set; }
    Property Value
    Type Description
    PixelPerfectCamera.GridSnapping

    orthographicSize

    Declaration
    public float orthographicSize { get; }
    Property Value
    Type Description
    Single

    pixelRatio

    Ratio of the rendered Sprites compared to their original size (readonly).

    Declaration
    public int pixelRatio { get; }
    Property Value
    Type Description
    Int32

    refResolutionX

    The original horizontal resolution your Assets are designed for.

    Declaration
    public int refResolutionX { get; set; }
    Property Value
    Type Description
    Int32

    refResolutionY

    Original vertical resolution your Assets are designed for.

    Declaration
    public int refResolutionY { get; set; }
    Property Value
    Type Description
    Int32

    Methods

    CorrectCinemachineOrthoSize(Single)

    Find a pixel-perfect orthographic size as close to targetOrthoSize as possible. Used by Cinemachine to solve compatibility issues with Pixel Perfect Camera.

    Declaration
    public float CorrectCinemachineOrthoSize(float targetOrthoSize)
    Parameters
    Type Name Description
    Single targetOrthoSize

    Orthographic size from the live Cinemachine Virtual Camera.

    Returns
    Type Description
    Single

    The corrected orthographic size.

    OnAfterDeserialize()

    Declaration
    public void OnAfterDeserialize()
    Implements
    ISerializationCallbackReceiver.OnAfterDeserialize()

    OnBeforeSerialize()

    Declaration
    public void OnBeforeSerialize()
    Implements
    ISerializationCallbackReceiver.OnBeforeSerialize()

    RoundToPixel(Vector3)

    Round a arbitrary position to an integer pixel position. Works in world space.

    Declaration
    public Vector3 RoundToPixel(Vector3 position)
    Parameters
    Type Name Description
    Vector3 position

    The position you want to round.

    Returns
    Type Description
    Vector3

    The rounded pixel position. Depending on the values of upscaleRT and pixelSnapping, it could be a screen pixel position or an art pixel position.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023