How to create a 2D split-screen?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dlean Jeans

I couldn’t find any solutions for this except for all the posts linking to the so-called deleted demo project split_screen_platformer (link: ).

Indeed, someone needs to rewrite it Need to port split screen demo · Issue #224 · godotengine/godot-demo-projects · GitHub

Zylann | 2018-05-02 12:39

:bust_in_silhouette: Reply From: SIsilicon

I created a split screen before in 3D.
All I did was create two viewports, each with their own camera, and show their textures in two texture_rects.

The same should apply in 2D, except you would need to use a camera2D instead (duh). And you may need to clear the world2D that it comes with.

view_port.world_2D = null

By the way I was basing that statement off of the viewport document, which looks kinda outdated; so you may want test that out yourself.

:bust_in_silhouette: Reply From: Dlean Jeans

After looking at the source code of the deleted demo project,
this is what works for me:


And the script:

var world = $ViewportContainer/Viewport.find_world_2d()
$ViewportContainer2/Viewport.world_2d = world

Old demo links:

The code for parallax and split modes is also available in the last link.