OptionButton renders incorrectly when embedded as GUI in 3D

Godot Version

4.5.1.stable

Problem

Hello community, I need your support this time :slight_smile:

These screenshots summarize my issue:


Here’s a short video of me browsing through the menu, everything works flawlessly except for the LanguageButton (which extends OptionButton).

I have implemented the GUI in 3D by adjusting this official demo project to work with my main menu:

Here’s a scene tree of the MainMenu with the position of the LanguageButton:

The problem comes from a fact that OptionButtons spawn a PopupMenu that displays the options and that PopupMenu is rendered in a separate Viewport, which is not part of the Viewport that gets rendered onto the TV. Here’s a screenshot of the scene at runtime showing the PopupMenu.

Question

Is there any way to make this PopupMenu be part of the Subviewport rendered on the TV?

If not, the only solution I see is to create my own custom OptionButton that would spawn a custom-made-options-menu (not based on the PopupMenu) in the same Viewport. Any better ideas?

1 Like

Try enabling Viewport.gui_embed_subwindows in your SubViewport

1 Like

Yes! That was it! I had a feeling there must be a simple solution to that :slight_smile:

Thank you.

The only difference in behavior now is that the popup is not being hidden when I click outside of the popup’s area. But it’s not a big deal to me.