Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Pixel Perfect - change "Reference Resolution" via script

Discussion in '2D' started by Domarius, Sep 26, 2020.

  1. Domarius

    Domarius

    Joined:
    Jan 5, 2013
    Posts:
    103
    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?
     
    Last edited: Sep 27, 2020
  2. Domarius

    Domarius

    Joined:
    Jan 5, 2013
    Posts:
    103
    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.
     
    bobby55 and haqpod like this.