How to minimize game window at runtime?

I found FGenericWindow::Minimize(),but i don’t know how to use it.

1 Like

Hi ayconanw,

Here is a small code snippet. You can try to use it to minimize your game window.

#include "Engine/GameEngine.h"
#include "EngineGlobals.h"
#include "SlateCore.h"

...

#if !WITH_EDITOR

UGameEngine* gameEngine = Cast<UGameEngine>(GEngine);

if (gameEngine)
{
	TSharedPtr<SWindow> windowPtr = gameEngine->GameViewportWindow.Pin();
	SWindow *window = windowPtr.Get();

	if (window)
	{
		window->Minimize();
	}
}

#endif // !WITH_EDITOR

...

Hope this helps.

1 Like

Thanks very much,it works.

How would it be done in player controller?