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?
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 :
Main camera with :
Correct viewport rect
A Depth value set to 0
A culling mask to Everything, except Player1Layer and Player2Layer
A second camera with :
Correct viewport rect
A Depth value set to 1
A culling mask to Player1Layer (or Player2Layer for 2nd player)
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.