Since this is now a thread full of ways to access the game window, here’s one I encountered used by epic:
void FindSceneViewport (OutInputWindow, OutSceneViewport) in VirtualCameraActor.cpp. It does the most straight forward UGameEngine approach in builds, and a widget search in editor. That editor dependency won’t work in builds, so you can modify your build.cs to add it conditionally.
if (Target.bBuildEditor == true)
{
PrivateDependencyModuleNames.Add("UnrealEd");
}
Here’s hoping this is the last post I’ll have to make in this thread.