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

Post tutorial Report content RSS feed Splitscreen cameras

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

Posted by on - 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

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.

Reply Good karma Bad karma+1 vote
Guest
Guest

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

Post a comment

You are not logged in, your comment will be anonymous unless you join the community. Or sign in with your social account:

Established
Privacy
Public
Subscription
Open to all members
Contact
Send Message
Homepage
Unity3d.com
Membership
Join group
Group watch
Start tracking
Tutorial
Browse
Tutorials
Share
Related Games
CarEdu
CarEdu Racing
Related Engines
Unity
Unity Commercial
Related Groups
Indie Devs
Indie Devs Hobbies & Interests with 1,342 members
Unity Devs
Unity Devs Hobbies & Interests with 1,498 members