Scripting Support (C#)

advanced scripting

Split Screen Pro · Scripting Support (C#)

Class: All members on this page belong to the SplitScreenManager component (namespace SplitScreenPro). Access via GetComponent<SplitScreenManager>().
Tip: Check the demo scene scripts for runtime usage examples.

Getting Started

Add using SplitScreenPro; at the top of your script. Access the manager through its singleton instance:

using SplitScreenPro;

SplitScreenManager ssm = SplitScreenManager.instance;
ssm.splitMode = SplitMode.SplitScreenAutomatic;
ssm.cameraDistance = 30f;

SplitScreenManager (Component)

Properties

static SplitScreenManager instance { get; }

Singleton instance of the manager.

Transform player1

Transform of the first player.

Transform player2

Transform of the second player.

SplitMode splitMode

Current split screen mode.

Camera mainCamera

The main camera component used for rendering.

float cameraDistance

Distance from camera to players.

float cameraVerticalRotation

Vertical rotation angle of the camera in degrees.

float cameraHorizontalRotation

Horizontal rotation angle of the camera in degrees.

bool cameraDistanceManaged

Automatically zoom out to keep both players in view.

float splitLineAngle

Angle of the split line in radians (-π to π).

float splitLineWidth

Width of the split dividing line in pixels.

Color splitLineColor

Color of the split dividing line.

float yAxisOffset

Vertical offset applied to player positions (useful to aim at character center).

bool splitAudio

Enable split audio (sounds emitted relative to nearest player).

float downsampling

Downsampling factor for camera rendering (0.1–1.0). Lower values improve performance.

SplitScreenState currentSplitScreenState { get; }

Current state of the split screen rendering.

Static Methods

static void PlayClipAtPoint(AudioClip clip, Vector3 position, float volume = 1f)

Play an audio clip at a world position, automatically adjusted for split screen mode.

clip
Audio clip to play.
position
World position of the sound source.
volume
Volume (0–1).

SplitMode (Enum)

Off — Split screen disabled. SingleCameraOnPlayer1 / SingleCameraOnPlayer2 — Follow one player. SplitScreenFixedDivision — Fixed split with adjustable angle. SplitScreenAutomatic — Dynamic split based on player separation. SplitScreenIndependent — Independent side-by-side cameras.

SplitAudioSource (Component)

Add this component to GameObjects with an AudioSource to enable split screen audio. It automatically creates a mirror audio source and adjusts spatial positioning based on the split screen mode. No additional scripting is required — just add the component.

Code Examples

using SplitScreenPro;

// Switch between modes at runtime
SplitScreenManager ssm = SplitScreenManager.instance;
ssm.splitMode = SplitMode.SplitScreenAutomatic;

// Change camera angle and distance
ssm.cameraVerticalRotation = 45f;
ssm.cameraDistance = 25f;
ssm.cameraDistanceManaged = true;

// Customize split line appearance
ssm.splitLineColor = Color.white;
ssm.splitLineWidth = 3f;

// Assign players dynamically
ssm.player1 = player1Transform;
ssm.player2 = player2Transform;

// Play a positioned audio clip
SplitAudioManager.PlayClipAtPoint(explosionClip, transform.position, 0.8f);
Was this page helpful?