Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Resolved Veiwport Rect for Camera rendering to Target Texture

Discussion in 'Editor & General Support' started by broarty, Sep 28, 2020.

  1. broarty

    broarty

    Joined:
    Sep 28, 2020
    Posts:
    3
    Not sure where to go for help on this. I have been looking and looking but I haven't found anyone else post about this specific issue. Works fine on windows and in the editor but I can't figure it out here.
    I have a project that lets you select a character and then, when creating your playable character, sets the viewport rect of the Camera to the proper scale and place for split screen:
    player 1 on the left and player 2 on the right
    screenshot good.PNG

    When I build the game for mac, The last player that is spawned (whether that is 2nd, 3rd, or 4th player) has their camera stretched to fit the entire screen:
    Screen Shot 2020-09-28 at 2.11.55 PM.png

    Details:
    Built from a Windows PC
    The Camera.rect is being set by script in Awake().
    Each player camera is rendering to the same render texture. That texture is being drawn on the GUI layer by script.
    There is post processing but it doesn't seem to make a difference when I disable it for the build.
    The UI renders fine because its rect scale is still set to 1 on both the width and height and it is placed in the middle.
    Playing one player works perfectly fine. Only get this when I change viewport rect on camera to something other than the normal (0,0,1,1).

    Thank you if you take the time to read this, very much appreciated.
     
  2. broarty

    broarty

    Joined:
    Sep 28, 2020
    Posts:
    3