Pixel Perfect - change "Reference Resolution" via script

My game supports a 16:9 ratio (480x270) but I want to support 4:3 ratio and change to 360x270 if I detect the screen ratio is closer to 4:3 I want to change the camera (in the script) to be 360x270.

I just can’t find the script documentation for the pixel perfect camera; I only have this page from the manual which doesn’t list the member functions.

If this isn’t possible, maybe I could make another camera that is at 360x270 and switch to it if I detect a 4:3 ratio rather than change the resolution of the existing camera. How would I do this?

I got all the info I needed - I can enable / disable cameras from rendering with the .enabled property, but also I was able to find the script for PixelPerfectCamera by selecting the camera in the scene, right clicking on the component heading “PixelPerfectCamera” and clicking “Edit script”, that shows me everything I can change via script, including the reference resolution.

2 Likes