Search Unity

Get the GAME's Camera PixelRect

Discussion in 'Editor & General Support' started by boehmzViacommix, Feb 16, 2019.

  1. boehmzViacommix

    boehmzViacommix

    Joined:
    May 4, 2017
    Posts:
    16
    I have a screenshot function that captures the game view's current view into a texture but it relies on Screen.width/height and the camera's pixelRect. I want to make an inspector button to capture the screenshot but the problem is both Screen.width/height and Camera.main.pixelRect are relative to the active window.

    This creates a capture based on dimensions of the inspector window rather than the actual game view. Is there a way to get the camera properties of the GAME view and disregard screen sizes of the current active window?