Assign new world_2d in only one viewport in a split screen setup.

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

I have 2 viewports setup for multiplayer split screen. Viewport1 has the world scene as a child. Viewport2 is set as:

viewport2.world_2d = viewport1.world_2d

I want, for example, player 1 to be able to leave world and enter into a new world scene while player 2 stays in the world 1 scene. The problem with this is the world scene has to be a child of viewport1 and once that changes, viewport2’s world scene would change as well. Each world would also need to be persistent so long as a player remains in said world.

:bust_in_silhouette: Reply From: Drykul

I figured it out. In case anyone runs across this in the future, you set up viewports for each individual world scene but they will never be rendered. You simply assign whichever player’s actual viewport world_2d to the world you want to transition to container viewport world_2d then reparent the player node to that same world’s viewport node.