Building plugin fails when declaring a delegate, rebuilding or recompiling from editor works

The context

I have declared a delegate in a class header of a plugin and there is nothing wrong there.

The issue

But I cant build my code from Visual studio. Rebuilding from Visual Studio works fine, but when I build, the UBT fails silently (without any error message. It just says “couldnt produce item…”).
If I recompile the plugin from the editor’s module window, it compiles nicely but building from Visual Studio fails as soon as I make a change in my source code.


Why cant I build from Visual Studio when I declare delegates, but have to recompile from the editor instead? Sounds like a bug to me.

Hey rYuxq-

If I understand correctly, once you add the delegate to your plugin, you then get compile errors if you compile inside Visual Studio but don’t get compile errors if you compile from the editor, correct?

Something to note, plugin code does not get compiled in a hot reload (compiling from the editor or through VS with the editor open). When you compile from the editor it does not check the plugin code and instead only compiles the game code.

If you’re getting errors compiling inside Visual Studio, please provide the full error message as well as the code you’re using that is causing the compile to fail.

I didnt use the recompile button for the game code. I used the recompile button for modules (the one for my plugin, to be precise) from Window > Developer Tools > Modules.

Btw, the build from VS works (when I have declared delegates) if I close the editor before.
As for the error message… There is none, it just says that it couldnt produce the item.
I will see if I can provide an example project

When I create a new project and add a plugin to it, I’m able to compile using both the module compile button and directly inside VS. Can you provide the code you’re using for your plugin? Specifically, how are you declaring/using your delegate. Being able to match the setup you’re using should help me identify what is going on.

I cant seem to reproduce this error with a new project and plugin as well… It might be that I am getting that error with my project and plugin because I have been migrating it across multiple engine iterations… I have no clue. The setup for my existing plugin was simple: I have a component and I needed to add delegates to it. So I properly declared a delegate right above its class definition (above the UCLASS…). But when I tried to build it while my project was open in the editor, it failed silently. There was no error message. the UBT only said it couldnt produce the item. But if I tried to rebuild my project with the same setup instead, it didnt fail. It didnt fail either when I recompiled the plugin from the Modules window.

Unfortunately, I cant provide my project and plugin. I think, we can mark this as solved for the time being… Until I come up with a report that is more precise. Do you agree?

Hey rYuxq-

If you’re able to reliably reproduce the issue in a new project, feel free to comment here to reopen the post. For the time being I will mark this as resolved for tracking purposes.