When does the Engine set up the window ?

Hi everyone,

I’m setting up my window in MyPlayerController::BeginPlay function. I can see that my window is properly sized and placed for couple of frame. Then the Engine just decide to do its own way putting my window in fullscreen.

I’m just setting my window property using GEngine->GameViewport->GetWindow() but it seems I’m doing it too soon. But, BeginPlay is the last function called on my controller, which means everything should be ready to go.

I’m not using GameUserSettings.ini cause I run multiple clients with different configuration on the same computer. My GameUserSettings.ini file is empty so I guess the Engine will use default value for window setup. But it does it way too late so it just ■■■■ up my own settings.

If I call again my setup later (for example with an UI button, the window set up properly as expected).

When and why the Engine does setup its window ? When should I do my own ?

Thanks for reading. Best regards.

Your question was submitted, and will be reviewed by a moderator before being visible to all users.

Thank god. No more spam on this forum ! :slight_smile:

All right, my question is still open, but for people who encounter the same issue here is a possible but dirty fix:

  • In my PlayerController::Tick (or whatever class your want) function, I check whether the position/size/mode of the window I defined at start is properly applied.

  • If not, I reset my window properties

    void APOLICE_MainMenu_PlayerController::Tick(float DeltaSeconds)
    {
    Super::Tick(DeltaSeconds);

     UPOLICE_GameInstance *GameInstance =
     	Cast<UPOLICE_GameInstance>(GetWorld()->GetGameInstance());
     if (GameInstance)
     {
     	GameInstance->CheckWindowProperties();
     }
    

    }


void UPOLICE_GameInstance::CheckWindowProperties()
{
	if (!GEngine || !GEngine->GameViewport ||
		!GEngine->GameViewport->GetWindow().IsValid())
	{
		return;
	}

	if (GEngine->GameViewport->GetWindow()->GetSizeInScreen() != m_windowSize ||
		GEngine->GameViewport->GetWindow()->GetPositionInScreen() != m_windowPosition ||
		GEngine->GameViewport->GetWindow()->GetWindowMode() != m_windowMode)
	{
		SetupWindow(true);
	}
}

I’m closing the question since it has no answer for 10 days and I fixed the issue with my own way :slight_smile: