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

Camera Viewport

Discussion in 'Scripting' started by sherlockturtle, Apr 4, 2015.

  1. sherlockturtle

    sherlockturtle

    Joined:
    Jan 23, 2012
    Posts:
    592
    Hey All! I am wondering if it is possible in game to change the camera's viewport or if you need specific settings on the camera to do this? If I run the code below it will change the values, but the actual game view stays the same as full screen.

    Code (csharp):
    1.  
    2.   void Start()
    3.     {
    4.     Camera.main.rect = new Rect(0.5f,0.5f,0.5f,0.5f);
    5. }
    6.  
     
    Last edited: Apr 4, 2015
  2. sherlockturtle

    sherlockturtle

    Joined:
    Jan 23, 2012
    Posts:
    592
    I solved the problem actually. It had to do with another part of the script.

    Thanks though!