In a plugin, I have an interfaced defined like this:
UINTERFACE(BlueprintType)
class PLUGIN_API UInterfaceInPlugin: public UInterface
{
GENERATED_BODY()
};
class PLUGIN_API IInterfaceInPlugin
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
void InterfaceFunction();
};
But when I search for InterfaceFunction in Blueprint Actions, I cannot find any mention of it.
However, I know the engine is aware of my interface because I can still have my Blueprint classes implement it and theInterfaceFunction will show up as an interface function on the blueprint class!
If I move the UINTERFACE declaration over to my main game module and change PLUGIN_API to MYGAME_API, actions appropriate for the InterfaceFunction appear as expected.
Why won’t the Interface Function (Message) action appear in my blueprints if the interface is in a plugin module? Why do I need to have the UINTERFACE in the main module to have this option?
Did you recompile your plugin from the modules tab?
You can also try refreshing the blueprint.
When working with plugins, I often have issues with BlueprintNavtiveEvent functions not appearing in the context-sensitive window until I rebuild the Intermediate and Binaries within the plugin itself.
Close project
Go to your plugin directory (not project directory)
Delete the Intermediate + Binaries directory
Reopen the project, it will ask you to rebuild the plugin module, click yes.
Your public interface functions should be exposed.
If this doesn’t work, then I will take a deeper look at the issue.
You’re telling me how I can implement the function in Blueprint. That is not the problem I have described. The issue is that I cannot make the interface “message” calls as those message nodes do not seem to be available ONLY when the interface is declared in a plugin.
Thanks for the suggestion. Unfortunately, after deleting those folders and rebuilding that module, I still do not get the Interface Function (Message) node.
I note that I would like to add here is that in following your instructions I did launch the editor from the UE4 launcher. However, I normally run the editor as a child process of Visual Studio. I just wanted to point that out so we can mark off the launch/build method as a potential cause.
I just created a test plugin, as it’s been a while since I have used interfaces. I think your problem might be the attributes defined in the UFUNCTION() macro. You should not use the BlueprintCallable attribute. I will give an example of a Blueprint Native Event declaration and a Blueprint Implementable Event declaration.
Blueprint Native Event = Definitions in BP and C++
Blueprint Implementable = Definition in BP only
Here is what I did.
Create a new plugin TestPlugin
Add an actor class to the plugin called TestInterface
Removed everything to do with the Actor class and Renamed ATestInterface to UTestInterface
Added the appropriate class definitions
// Fill out your copyright notice in the Description page of Project Settings.
**At this point, I had the same issue where I could implement the events, but I could not call them **
I deleted the following folders [Project]/Binaries, [Project]/Intermediate, [Project]/Plugins/TestPlugin/Binaries, [Project]/Plugins/TestPlugin/Intermediate
I seem to have fixed the issue. The example plugin that I generated had an “Editor” module type. I changed this from “Editor” to “Runtime” (.uplugin file) and rebuilt everything like @Alekann01 did, and I began seeing the interface message nodes.