Compiling changes in a manually added module

I had a plugin that contained source code.
To make any changes in a plugin source code, you must relaunch editor to kick off proper compile and reloading, this wasn’t a great scenario for iterative code changes.

I moved the code out of a plugin folder structure, and instead wanted to add it to my main project, but also wanting it separated, I made it into a module.

I manually added the module to my .uproject and made the appropriate changes in visual studio to reflect the new build.cs, and other appropriate includes for the libs and other components for it to compile.

It now mostly works great.
However, in my Binaries\Win64 folder where the dll for my primary game and for my secondary module.
When I make changes to the primary one, it makes incremental changes and allows me to recompile and whatnot, it adds some -####.dll but doesn’t permanently block the dll.

However with my new secondary module, it appears to lock the dll, and refuses to allow it to pull in and make changes with compilation.

What other steps do I need to take here to able to iterate on this module c++ code without having to restart the editor for each small incremental change?

Hi, Did you try from the editor menu: Window->Developer Tools->Modules and click “recompile” button for your module?

UE4 indeed don’t support hotload on plugins and it’s a known thing, if other modules don’t hot reload properly on game project, i would say this is a bug worth reporting. Hot reload is general is not perfect.

You can try manually reload modules with “module load” and “module unload” console commands (use output log window), remember to properly code module cleaning on unload or else you might have unexpected crashes.

Aha! I think that might have been it!

In the modules window, that particular module doesn’t have unload/reload on it? Does that mean it’d still support it via console?

However, the Recompile thing worked and is now resolved. Thanks!

There console commands to load in unload modules, you cna use that window too if you wish :stuck_out_tongue: I’m saying that if you dynamically unload module you need to cleaning in ShutdownModule() in module class, like unregistering asset types, remove any extenders ig you use them, undo everything that you do in StartupModule(). If you don’t do that and dll will be removed from memory on unload (and reload too) engine will have ton of invalid pointers which may cause crash.

In the module there is a virtual function called :

virtual bool SupportsDynamicReloading() override { return false; }

overload this and return true.

Oh good find, didn’t know about this one