How do I enable the Oculus Rift in a Packaged Game?

I believe the problem is that the “fullscreen” command is a toggle rather than a setting. In GameViewportClient.cpp’s Exec() method we have this code:

	else if( FParse::Command(&Cmd,TEXT("TOGGLE_FULLSCREEN")) || FParse::Command(&Cmd,TEXT("FULLSCREEN")) )
	{
		return HandleToggleFullscreenCommand( Cmd, Ar );
	}	

If you look at UGameViewportClient::HandleToggleFullscreenCommand() in the same file, you’ll find this line:

FullScreenMode = Viewport->IsFullscreen() ? EWindowMode::Windowed : FullScreenMode;

Here it is toggling between windowed and full screen modes. So if your game starts off in windowed and you call “fullscreen” then all is fine for the Rift. But if you call “fullscreen” a second time you end up going back into windowed mode. The frustrating part is that I haven’t found a way of checking that you’re in full screen mode from a Blueprint so you know not to call “fullscreen” a second time.

I believe one possible solution here is to make screen mode be a full Blueprint citizen with proper Get and Set methods rather than relying on the command system. UGameViewportClient already has a IsFullScreenViewport() method in C++, and could be exposed through a Blueprint function library, along with other useful viewport methods.

  • Dave