New Input Manager Split Screen and Cinemachine

Hi there,

I’m trying to figure out how to combine the new input system manager (with split screen enabled) and Cinemachine.

I linked a camera and a virtual camera in the player prefab, its hierarchy looks like this :

PlayerHolder
– Player
– PlayerCamera
– PlayerVirtualCamera

When the first player joins in, everything is fine, but as soon a the second one enters the game, the virtual camera pans to the second player on both screens.

Is Cinemachine compatible with the new input system? I know that Cinemachine works with split screen, as Unity made a Youtube tutorial about it:

Anyone got it to work?

3 Likes

I’m also trying to do a similar thing.
Would be very interested in a solution for this!

Hey! What I ended up doing is writing a setup script and change the VM cams and regular cams when a player is joining.

using UnityEngine;

public class PlayerManager : MonoBehaviour
{
    public Camera cam;
    public GameObject virtualCam;

    public void Setup(int layer)
    {
        virtualCam.layer = layer;
        var bitMask = (1 << layer)
            | (1 << 0)
            | (1 << 1)
            | (1 << 2)
            | (1 << 4)
            | (1 << 5)
            | (1 << 8);
        cam.cullingMask = bitMask;
        cam.gameObject.layer = layer;
    }
}

I keep a List of PlayerInput somewhere in the app (in my case, in a scriptable object) hooked up to Player Input Manager’s events, and assign layers based on their index in this list.

4 Likes

At the moment, split-screen in Unity is not compatible with Cinemachine. I came across this post looking for a guide to local multiplayer in Unity and then accidentally found the answer to your problem in Unity’s new input system documentation. 5418609--550758--Capture.PNG

It’s not plug and play but we can make it work with a little bit of code, see my answer above.

1 Like

@Northmaen Im interested in your solution but I dont know how to do the event and set it, could you explain? :slight_smile:

Hey @MarNevGames , events are fired by the buil-in Player Manager, i did not set them. You can just hook your function like you do with UI buttons for example.

Hey @Northmaen , your solution just saved me, thank you so much!

Thanks for the Code Northmaen! I have a question though. What is camera and virtualCam? is the camera PlayerInput.camera? Then what is virtualCam?

Hi there,

as @Northmaen mentioned i implemented the same camera initializer for my local multiplayer, but i still have the same bug.
I also checked the instructions of “monkeykidgc.com
(https://www.monkeykidgc.com/2020/12/unity-split-screen-multiplayer-using-cinemachine-follow-cameras.html).

My playerPrefab structure :

PlayerParent

  • Camera
  • Amature
  • ThirdPerson Controller
  • Cinemachine Cam

Any ideas ?

Can you put more screenshots of it please?

I know this is 2 years late but this video works wonders!

1 Like