For all Unity developers and developers-to-be, both beginners and professionals!

Report article RSS Feed Splitscreen cameras

How to set cameras to simulate the splitscreen multiplayer mode in Unity.

Posted by feillyne on Oct 17th, 2010
Basic Other.

First, duplicate your Main Camera (in the Hierarchy section, select your Main Camera object, then press CTRL + D)

You need to set both cameras appropriately.

The first camera, change
X (X coordinate) to 0
Y (Y coordinate) to 0.5 (starts from the middle of the screen, the Y position)
H (Height) to 0.5 (0.5 means 50%)

The second camera, change
X (X coordinate) to 0
Y (Y coordinate) to 0
H (Height) to 0.5 (50% of the screen)

You can look at the pictures below:

Main_Camera properties

Main_Camera2 properties


You also need to set Targets of these cameras - best to set the two characters as the targets. In the CarEdu project, both car objects' (Car, Car2) CenterOfMass elements were set as targets.

That's all if you mean creating the splitscreen multiplayer mode cameras. See the splitscreen input tutorial for setting up keys for two players:
Indiedb.com

Post comment Comments
PhobicGunner
PhobicGunner Jul 18 2012, 11:24am says:

Bad tutorial imho (not to be rude). This is just going to result in a console clogged with error messages ('There are 2 audio listeners in the scene'). Sure I could delete one of them, but that means Player 1 is going to hear sounds, and Player 2 is going to hear jack nada.
I think you really need to look into and research what it is you're attempting BEFORE you make a tutorial. I also think splitscreen warrants more than a 'basic' tutorial - after all, trying to figure out the whole audio mess is trickier than it first sounds.
Sure, it's easy to change the camera rect - anybody who bothers to read the documentation knows that.
As for the input tutorial, that is BAD PRACTICE - you NEVER just wholesave DUPLICATE a script for the sole purpose of changing a string!! Why not just expose the axis name as a property!? It's MUCH cleaner. Duplicating stuff like that will NOT land you a job in this industry, that's for sure.
Sorry. Rant over.

+1 vote     reply to comment
Guest
Guest Feb 19 2013, 3:48pm says:

This comment is currently awaiting admin approval, join now to view.

Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Established
Oct 31, 2010
Privacy
Public
Subscription
Open to all members
Homepage
Unity3d.com
Contact
Send Message
Email
Members Only
Membership
Join this group
Group Watch
Track this group
Tutorial
Browse
Tutorials
Report Abuse
Report article
Related Games
CarEdu
CarEdu Indie Single & Multiplayer Racing
Related Engines
Unity
Unity Commercial Released May 30, 2005
Related Groups
Indie Devs
Indie Devs Hobbies & Interests group with 1,092 members
Unity devs
Unity devs Hobbies & Interests group with 1,174 members