Subscene in Viewport

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By molamar
:warning: Old Version Published before Godot 3 was released.


is it possible to instance a scene within a Viewport with a proper resolution like the scene would run on Device?
Lets say i create a minigame by 800x600 resolution. Then i want to instance it into a (main)scene which contains a Control/viewport with the resolution by 400x300.
So the whole instanced scene must be scaled down ( like running on a device with 400x300).
I’ve tried to set_screen_stretch, but it seems this affects just the Scene Tree with the RootViewport(what would make sense), so i guess i’ll have to handle this with my (Own2nd)Viewport.
i also tried set_size_override and set_size_override_stretch, but this affects just the Viewport itself not the contentscaling.

Thx for any help.

:bust_in_silhouette: Reply From: avencherus

Typically this is accomplished with a ViewportSprite. If it’s in 3D you can drop it onto a CanvasLayer.

The custom Viewport node will have a rectangle that represents the resolution. So you would keep that at 800x600. Then assign the Viewport to the ViewportSprite and from their modify the scaling of the ViewportSprite. In your case it looks like (.5, .5) are the values.