- Home /
 
              This question was 
             closed Jan 07, 2017 at 10:00 PM by 
             jaredlevi for the following reason: 
             
 
            The question is answered, right answer was accepted
 
               Question by 
               jaredlevi · Jan 07, 2017 at 09:07 PM · 
                cameraviewportresizesplit-screen  
              
 
              4 player split screen
I am trying to have two cameras resized when four player is true. Player ones camera needs to move the left. If any one can help I would be grateful.
          //4Player
          var FourPlayer = false;
          var Player1WorldCam : Camera;
          var Player1HudCam : Camera;
          var Player2WorldCam : Camera;
          var Player2HudCam : Camera;
          var PL3 : GameObject;
         var PL4 : GameObject;
         var PL3HUD : GameObject;
         var PL4HUD : GameObject;
     
     function Start () {
     if (FourPlayer == true){
         Player1WorldCam.GetComponent.<Camera>().rect = new Rect (0.5, 0.5, 1,1); 
         Player1HudCam.GetComponent.<Camera>().rect = new Rect (0.5, 0.5, 1, 1); 
         Player2WorldCam.GetComponent.<Camera>().rect = new Rect (0.5, 0.5, 0.5, 1); 
         Player2HudCam.GetComponent.<Camera>().rect = new Rect (0.5, 0.5, 0.5, 1);
     }
     else{PL3.SetActive (false); PL4.SetActive (false); PL3HUD.SetActive (false); PL4HUD.SetActive (false);
     
     
     }
 
 
               
 
                 
                wow.jpg 
                (356.6 kB) 
               
 
              
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Hellium · Jan 07, 2017 at 09:06 PM
The two last parameters of the Rect is width and height, and must be set to 0.5, not 1
      TopLeftCam.rect = new Rect (0, 0.5, 0.5, 0.5); 
      TopRightCam.rect = new Rect (0.5, 0.5, 0.5, 0.5); 
      BottomLeftCam.rect = new Rect (0, 0, 0.5, 0.5); 
      BottomRightCam.rect = new Rect (0.5, 0, 0.5, 0.5);
 
              the player one view port is still rendering an top of the player two view port. No matter what number i put in for width and height. can you explain why i cant move it past the center of the screen.