Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • 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

avatar image
0
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);
     
     
     }
 






alt text

wow.jpg (356.6 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

  • Sort: 
avatar image
1
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);
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image jaredlevi · Jan 07, 2017 at 09:17 PM 0
Share

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.

avatar image Hellium · Jan 07, 2017 at 09:23 PM 0
Share

@jaredlevi: Updated answer with correct Rect

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make a split-screen? (2 cameras rendering at same time) 4 Answers

Multiple cameras such as in MarioCart 1 Answer

Clamp camera to multiple on-screen players 0 Answers

Second Camera Position on Viewport to UI Element Position on Screen 2 Answers

Camera Viewport Height - Horizontal Transition 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges