How to get the next Pixel Perfect Orthographic Size

My object has the Cin machine pixel perfect component added to it
I have a pretty simple zooming script here. When the user zooms in/out change the orthographic size

                mapVirtualCamera.m_Lens.OrthographicSize = newOrtho;
                cameraBrain.ManualUpdate();

however, if the new OrthographicSize is not pixel perfect, when you update the camera, the camera will not switch to the new orthographicSize as expected.

How can I get the next pixel perfect orthographicSize?

I know I can use a loop and then check if the main camera orthographicSize changes, but that would require multiple manual updates which I rather not do.

Cinemachine itself tries to remain agnostic about PixelPerfect. The idea is that the (non-Cinemachine) PixelPerfect behaviour on the main camera will round the desired ortho size to the nearest PP ortho size. The CinemachinePixelPerfect component accesses an API in the (non-Cinemachine) PixelPerfect component to get the rounded size: PixelPerfectCamera.CorrectCinemachineOrthoSize().

1 Like

Thank you very much, this is exactly what I was looking for.
I was looing for such a method in the Pixel Perfect camera class from cinmachine library, meanwhile it was in the pixel perfect camera from UnityEngine.U2D

1 Like