0 votes

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.

in Engine by (23 points)
edited by

2 Answers

+1 vote
Best answer

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.

by (23 points)
0 votes

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...

by (18 points)

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.