Viewports do not show the scene inside them

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

Here is my node layout:

Node2D
    |- HBoxContainer
        |-ViewportContainer
            |-Viewport
                |- Camera2D
                |- Node2D (the linked scene)
        |-ViewportContainer
            |- Viewport
                |- Camera2D
                |- Node2D (the linked scene)

The linked scene looks like this:

Node2D
    |- CanvasLayer
         |- ColorRect

They do not show neither in the editor nor while running (they are black). The Camera2Ds are set as current. The ViewportContainers take half of the screen by using size flags and have the “Stretch” property enabled.

:bust_in_silhouette: Reply From: metus

I think you are missing an element to display the viewport in. A viewport container for example; like:

Node2D
|- HBoxContainer
   |-ViewportContainer
     |-Viewport
        |- Camera2D
        |- Node2D (the linked scene)
   |-ViewportContainer
     |-Viewport
        |- Camera2D
        |- Node2D (the linked scene)

Althought I am trying unsuccessfully to use viewports so…

Sorry, I had my ViewportContainers but forgot to write them in the question haha

tomadimitrie | 2020-01-18 18:58

:bust_in_silhouette: Reply From: tomadimitrie

Turns out it was a bug. The viewports inside the ViewportContainers had 0 size, so the solution is giving them the ViewportContainer’s size or resizing the ViewportContainer to something else then undoing, thus making the Viewport take its size.