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

I am using the DK1 Rift in the Realistic Rendering Project, and it’s working very well. I want to package the game and use the Rift with it. Once you have started the .EXE file, how do you enable the Rift? I’ve looked all over the forums and the docs and can’t seem to find an answer. Thanks for the help!

Would pressing alt+enter to go fullscreen work for you? If you do it while the Rift is connected it goes into stereo mode automatically.

That’s not working for me. I’m also now in 4.2, and packaging the Mobile Temple level. Alt+Enter doesn’t work. Any thoughts?

I’m having the same problem.

I’m having the same problem. Latest version of everything and alt-enter works for the Realistic Render (although it’s extremely overexposed in the rift.) Works for no other package.

Hi! i´m having the same problem in 4.3

Hi everyone,

We have added additional Oculus support into 4.4.3. I just tested several of our projects and the Alt+Enter command seems to work just fine in each one when they are packaged.

If for any reason you have issues getting your Oculus to work in 4.4.3, make sure that you have the latest version of the Oculus SDK.

TJ

I am using 4.6 and I have Oculus Runtime 0.4.4 installed. When I run a standalone game from the editor and hit Alt-Enter, the Rift works fine. However, when I package my game, and run it, Alt-Enter doesn’t work at all. I also have added a node at the beginning of gameplay to run the console command “stereo on”, but it doesn’t work at all.

Is there a more formal way to add HMD support to a packaged game? Thanks.

Hey -

Inside the level blueprint, you should be able to include an Event Begin Play node connected to an Execute Console Command node that runs the command “stereo on” or “fullscreen.” Using stereo on will enter the oculus if it is set to to Direct mode while fullscreen will enter the Oculus in both Direct and Extended modes.

Cheers

Thanks, , but that’s not working. I currently have an Event Begin Play node hooked into an “Execute Console Command” with “stereo on” and it doesn’t do anything in the build. It works great in Standalone, but nothing when built. Makes no sense why it’s not working when built. As for the fullscreen, I’ll have to try that. Stay tuned.

Hey -

Were you able to test using the Fullscreen command in your packaged game? Just for clarification are you using the Oculus in Direct mode or Extended mode? Are you setting up the Begin Play and Execute Console Command nodes inside the level blueprint or in another blueprint?

“Fullscreen” seems to work, somewhat. I have “Event Begin Play → Command (fullscreen)” in all 4 level blueprints of my demo. The interesting thing is that it works on the first load of the main menu. When you enter a new level, it doesn’t go full screen. You have to reload the level, and then it recognizes it. When you exit back to the main level, the fullscreen command no longer works. Here’s a video showing what is happening. IT seems like sometimes it is working on begin play, and other times it is not. Thanks!

If you’re using multiple levels you may want to try setting the begin play event in the game mode rather than inside each level. If that still doesn’t give the behavior you’re looking for then you can go into the Editor Preferences under the Play option and control the resolution there.

Cheers

Thanks for the help, . I removed all “Event Begin Play” nodes out of the level blueprints, and replaced it with an "Event Begin Play → Command (Fullscreen) in the Game Mode event graph. It’s still random. Works on the first level, and on one other, but fails on the other two. Any other thoughts? If I change the resolution in the editor preferences, that doesn’t change the build resolution, only the editor resolution, correct?

Barry

Do you happen to change the game mode between levels? The only other solution that comes to mind would be to set fullscreen inside the DefaultGame.ini file though I’m not sure how to do so.

Looks like it’s something happening in our custom game mode. The only reference I can find to full screen is the one I put in the event graph of the game mode. There are no other references to it. But it’s still inconsistent. When you go into a level, it works, but when you exit to the main level, it is disabled. I’ll record another video.

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

Hey -

Have you tried Gnometech’s suggestion of treating full screen as a setting instead of as a toggle? Let us know if you have any other questions or issues getting the game in full screen.

Cjheers

No, with the holidays, I haven’t had a chance to try it. As soon as I do, I’ll be sure to report on the status. It makes sense, but I’ll have to give it a shot. Thanks for the follow up! - Barry

Hey .

The problem is that UE4 itself doesn’t treat fullscreen as a setting, AFAIK. If we could have proper Blueprint functions and properties, rather than going through Execute Console Command, that would be a huge help. This is true for all OS-level window and viewport operations, not just fullscreen.

  • Dave