I have created a plugin using Slate/ C++ and would like to call a method on a blueprint (not necessarily and Actor class). As I am building a plugin, everything needs to happen in editor mode without ever running the game.
My Setup:
- SBlocksWindow inherits from SCompoundWidget
- ABlocksBuilderActor inherits from AActor
- ABlockBuilder_BP based on ABlockBuilderActor
In my SBlockWindow, I created a reference for ABlockBuilderActor as:
ABlockBuilderActor* blockBuilder;
In my UI I have a SComboBox which I use to select the actors available in the Level and use TActorIterator to populate it.
for (TActorIterator<ABlockBuilderActor> ActorItr(World); ActorItr; ++ActorItr) {
// Add a menu item for all available ABlockBuilderActor in the level editor
...
}
Now inside my ABlockBuilderActor, I have a function named StartBuildingBlocks with BlueprintImplementableEvent tag
UFUNCTION(BlueprintImplementableEvent)
void StartBuildingBlocks();
This function is implemented in the Blueprint. And at some point inside my SBlockWindow, I call this function
...
blockBuilder->StartBuildingBlocks();
...
PROBLEM:
StartBuildingBlocks() function is never called.
WHAT I TRIED:
- I tried calling different functions that are only implemented in c++ inside ABlockBuilderActor and they all work fine. Confirmed by logs.
- Tried adding other tags to the function as BlueprintCallable and BlueprintNativeEvent
WHAT I THINK MIGHT BE THE ISSUE:
- The reference I get from TActorIterator only returns the reference to the base class but I am not sure. when printing GetName() output the name for the blueprint in the level editor is logged.
- Cannot call blueprint functions in editor mode. But then you can create a function with the ‘Call In Editor’ option.
For a specific task (Render Material to Render Target), I need to use blueprints but they don’t necessarily need to be of type AActor. So if there is a suggestion for an alternate setup I am open to it. What am I doing wrong?