Scripting Support (C#)
advanced scriptingSplit Screen Pro · Scripting Support (C#)
SplitScreenManager component (namespace SplitScreenPro). Access via GetComponent<SplitScreenManager>().
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 player1Transform of the first player.
Transform player2Transform of the second player.
SplitMode splitModeCurrent split screen mode.
Camera mainCameraThe main camera component used for rendering.
float cameraDistanceDistance from camera to players.
float cameraVerticalRotationVertical rotation angle of the camera in degrees.
float cameraHorizontalRotationHorizontal rotation angle of the camera in degrees.
bool cameraDistanceManagedAutomatically zoom out to keep both players in view.
float splitLineAngleAngle of the split line in radians (-π to π).
float splitLineWidthWidth of the split dividing line in pixels.
Color splitLineColorColor of the split dividing line.
float yAxisOffsetVertical offset applied to player positions (useful to aim at character center).
bool splitAudioEnable split audio (sounds emitted relative to nearest player).
float downsamplingDownsampling 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);Suggest an improvement
Help us improve this documentation page.