diff --git a/editor/run/game_view_plugin.cpp b/editor/run/game_view_plugin.cpp index 4da0bcca4d5..e8df9406f85 100644 --- a/editor/run/game_view_plugin.cpp +++ b/editor/run/game_view_plugin.cpp @@ -44,6 +44,7 @@ #include "editor/gui/window_wrapper.h" #include "editor/run/editor_run_bar.h" #include "editor/run/embedded_process.h" +#include "editor/run/run_instances_dialog.h" #include "editor/settings/editor_feature_profile.h" #include "editor/settings/editor_settings.h" #include "editor/themes/editor_scale.h" @@ -672,6 +673,14 @@ GameView::EmbedAvailability GameView::_get_embed_available() { return EMBED_NOT_AVAILABLE_PROJECT_DISPLAY_DRIVER; } + if (RunInstancesDialog::get_singleton()) { + List instance_args; + RunInstancesDialog::get_singleton()->get_argument_list_for_instance(0, instance_args); + if (instance_args.find("--headless")) { + return EMBED_NOT_AVAILABLE_HEADLESS; + } + } + EditorRun::WindowPlacement placement = EditorRun::get_window_placement(); if (placement.force_fullscreen) { return EMBED_NOT_AVAILABLE_FULLSCREEN; @@ -731,6 +740,9 @@ void GameView::_update_ui() { case EMBED_NOT_AVAILABLE_SINGLE_WINDOW_MODE: state_label->set_text(TTRC("Game embedding not available in single window mode.")); break; + case EMBED_NOT_AVAILABLE_HEADLESS: + state_label->set_text(TTRC("Game embedding not available when the game starts in headless mode.")); + break; } if (available == EMBED_AVAILABLE) { diff --git a/editor/run/game_view_plugin.h b/editor/run/game_view_plugin.h index 0876f809f73..cfb00f5ba21 100644 --- a/editor/run/game_view_plugin.h +++ b/editor/run/game_view_plugin.h @@ -129,6 +129,7 @@ class GameView : public VBoxContainer { EMBED_NOT_AVAILABLE_FULLSCREEN, EMBED_NOT_AVAILABLE_SINGLE_WINDOW_MODE, EMBED_NOT_AVAILABLE_PROJECT_DISPLAY_DRIVER, + EMBED_NOT_AVAILABLE_HEADLESS, }; inline static GameView *singleton = nullptr;