Loading DesktopPlatform module

Hi there,

I’m trying to show an “open file” dialog in my game. I’ve got the dialog showing correctly when the game is run through the editor (after clicking “Play”), but the required DesktopPlatform module doesn’t seem to get loaded when the game is run standalone (“Development” build). I realize that this is probably intentional, as most games wouldn’t want/need to show an OS dialog like this, but I’m building a little in-game level editor which needs it. Any ideas how to load this module in my standalone app?

Thanks,
Matt

It should work, as the Unreal Engine Launcher does this.

It should just be a case of making sure "DesktopPlatform" is referenced as a dependency in your .Build.cs file, and then just doing the following in code to get the module interface pointer:

IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();

Are you using a binary (installed) build of UE4, rather than a source (GitHub) build?

Thanks for the quick reply. I’ve just tried this in my .Build.cs:

    PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "DesktopPlatform" });

And I get the following error:
LINK : fatal error LNK1181: cannot open input file ‘E:\Programs\Unreal Engine\4.5\Engine\Binaries\Win64\UE4Game-Redist-DesktopPlatform.lib’

The DesktopPlatform module only seems to exist in that dir as “UE4Editor-DesktopPlatform.dll”. Am I missing something?

Yep, just using a binary build

Okay, binary builds don’t have Development libraries built with them, as it’s against the EULA to distribute them with shipped products (sorry that I didn’t realise this before).

You’re actually the second person in a week to ask about this, so I’ll give you the same advice: “If we needed to pick a file in a game, we’d typically implement a custom Slate widget to handle it without having to spawn any additional windows, or rely on OS behaviour.”

You might want to consider a similar solution here, as it would allow you to style your picker to fit in with the rest of your game UI, and avoid any potential focus issues if your game was running full screen.

Here’s a link to the other question: [4.6] Compilation error when adding MainFrame module ? - Community & Industry Discussion - Epic Developer Community Forums

1 Like

Ok, thanks for the info!

Can you give some advice how to write widget,which c++ function can use in
ue4 ,Thank you!

You can’t. It’s illegal.

1 Like