Runtime plugin

Hi guys,

I’m working on a runtime plugin . My plugin works fine into the editor but when i click on “launch” (or when i test the packaged version) seems that the plugin is not loaded at runtime. Seems that in shipping my library is linked statically and not dinamically as happen in the editor. I can say this because i can’t find the win32 dll of my plugin and the StartupModule is not called at all.

note that in the uplugin file the type is setted to “runtime” and i have added EnabledPlugins=myPluginName to DefaultEngine.ini

any advice?

thanks,

Martino

This will cause numerous issues that I had to solve when I created my plugin.

First you need to force-load your plugin using the FModuleManager:

FModuleManager::LoadModuleChecked< IModuleInterface >("NameOfYourPlugin")

The next issue you will have is that when you compile for packaging with EnabledPlugins=YourPlugin in DefaultEngine.ini your plugin will be compiled as a static lib which will then be linked against the final executable. This has the side effect of stripping out all your UE4 type metadata, which means that if any Blueprints in your project use types in your plugin then they will fail to load with errors.

To fix this you can do one of two things: You can add a static method to your plugin that calls StaticClass() on all your types in the plugin, and call it from your game project somewhere OR you can remove your plugin from the list of EnabledPlugins in your DefaultEngine.ini when packaging: this will compile the plugin code monolithically as individual files added to the .exe (not as a static lib) which eliminates the type stripping issues.

It’s odd behavior and I’m not sure this is how Epic intended it to behave or not.

See my forum post here: Plugin types stripped out of build when packaged into game - C++ - Unreal Engine Forums

thanks Zoid, it works!

…but a plugin linked statically is not a real plug-in :stuck_out_tongue: