Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
avatar image
0
Question by diego_gonzalez · Jan 04, 2017 at 09:56 AM · instanceworldspaceworldworld space

Split the screen for multiplayer

I´m finishing a game development, but I have a new requirement, make it multiplayer (splitting the screen and running two instances).. There is a way to instance a scene at the same time, and render them in a different part of the screen? Or what is the best approach to achieve this?

Thanks in advance!

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

· Add your reply
  • Sort: 
avatar image
5
Best Answer

Answer by Hellium · Jan 04, 2017 at 09:56 AM

I will post here the same answer I gave you on StackExchange

If you want to make a local multiplayer with a split screen, the way to go is to have two cameras and change the rect viewport of them :

https://docs.unity3d.com/ScriptReference/Camera-rect.html

For vertical split screen : (x, y, width, height)

  • 1st camera : (0, 0, 0.5, 1) ► left

  • 2nd camera : (0.5, 0, 0.5, 1) ► right

VerticalSplitscreen

For horizontal split screen : (x, y, width, height)

  • 1st camera : (0, 0.5, 1, 0.5) ► top

  • 2nd camera : (0, 0, 1, 0.5) ► bottom

HorizontalSplitscreen


No need to have two worlds. However, if you want the players to have their own GUI, you will have to take a look at culling masks

https://docs.unity3d.com/ScriptReference/Camera-cullingMask.html

Place all the objects of the player 1 in a new layer ("Player1Layer"), all the objects of player 2 in another ("Player2Layer"), and make sure the camera of the player 1 does not have "Player2Layer" checked in its culling mask while the camera of the player 2 does not have "Player1Layer" checked in its culling mask.

IMPORTANT NOTE

It seems that additional configuration is required so as to show GUI to a specific player. I don't really know why.

Each player must have their own :

  1. Main camera with :

    • Correct viewport rect
      • A Depth value set to 0

      • A culling mask to Everything, except Player1Layer and Player2Layer

  2. A second camera with :

    • Correct viewport rect
      • A Depth value set to 1

      • A culling mask to Player1Layer (or Player2Layer for 2nd player)

  3. A dedicated canvas with :

    • Render Mode set to Screen Space - Camera
      • The correct camera configured in #2

For the sake of simplicity, attach the two cameras of a given player to a unique parent, and move the parent so that the two cameras will follow. Maybe, you can keep the cameras #2 at (0, 0, 0). I haven't tested.

Comment
Add comment · Show 3 · 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 Totoro205 · Sep 04, 2018 at 01:48 PM 0
Share

I know this is a bit old but i was wondering if it's possible to make a split screen with irregular shapes and more than one camera?

avatar image Hellium Totoro205 · Sep 04, 2018 at 02:42 PM 1
Share

I guess you can, but not with this technique.

$$anonymous$$aybe, you can use a RenderTexture to render what the cameras see, and "crop" the output with the $$anonymous$$ask component or with the Graphics.Blit function. Before blitting the texture, you could change the Texture by using SetPixels (not really advised), or with a cutom shader I guess.

avatar image RageBunny · Sep 28, 2018 at 04:33 PM 0
Share

Awesome dude, thx! :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Updating world coordinate according to world points 1 Answer

Trying to position a world space menu in front of the camera whilst ignoring the camera's tilt angle 1 Answer

world space shader giving me a weird glitch when i running my project 0 Answers

Multiple world spaces? 0 Answers

Are there any world bounds in Android? 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