Change scene inside a SubViewport

Godot Version



I have my Godot project set up so that a 3D scene (level 1) is inside a SubViewport scene. It is done like this so I can render my game at a lower resolution while keeping my UI at a higher resolution.

I want to change scenes in my project so I can go from level 1 to level 2, while still staying inside the SubViewport scene. How would I do this?

Two ways:

  1. Already the level in that viewport so that you can change it with show/hide function
  2. You can add the level as a child of that viewport and queue free the previous level
1 Like
var subviewport = $SubViewport  # Replace with your actual node path
subviewport.viewport_path = "res://path/to/your/subscene.tscn"
1 Like