On the surface, everything looks as it should. That said, remove your declaration of the _Implementation method. The UFUNCTION macro does that for you so declaring it yourself might be messing something up. Also make sure you’re not doing any sort of live coding. Make your change, build then bring the editor up.
Beyond that, I don’t see anything out of the ordinary.
I think the problem is the data type of UDialogueDataManager* DDM.
Constructing with DDMClass surely, but the actual data type could be UDialogueDataManager* not BP_DialogueDataManager.
All I want to do is just call SelectDialogueName() or SelectDialogueName Event from BP_MyUserWidget. I’m not persist to use C++ code, then I tried this.
“Blueprint Runtime Error: “Accessed None trying to read property CallFunc_SpawnObject_ReturnValue”. Node: Select Dialogue Name Graph: EventGraph Function: Execute Ubergraph BP My User Widget Blueprint: BP_MyUserWidget”
I’m very impressed your kindness. Thank you again.
I perfectly mimicked your codes and BPs, only I get “SelectDialogueName called from C++”.
Overriding function in BP may being fail?
May DDM class have a problem potentially?
DDM.h
UCLASS(Blueprintable)
class MYPROJECT_API UDialogueDataManager : public UObject
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
void SelectDialogueName();
virtual void SelectDialogueName_Implementation();
};
DDM.cpp
#include "DialogueDataManager.h"
void UDialogueDataManager::SelectDialogueName_Implementation()
{
GetWorld();
GEngine->AddOnScreenDebugMessage(-1, 10, FColor::Orange, TEXT("SelectDialogueName called from C++"));
}
Can the property UCLASS(Blueprintable) or inheriting UObject be a problem?
Now I have totally no idea, so I pointed out what I found.
I found World Context Object pin in PrintString node whitch your sample did not have.
So I pinned a variable whitch is current Level. But that was not the matter.
I wanted to place these specific functions outside of MyUserWidget, if I place them in MyUserWidget this problem cannot be exist though.
Ok so seeing that UDialogueDataManager extends UObject changes the situation bit. I will try to rework the solution to work within the confines of the base class UObject.
You need at least 2 parameters where the second parameter is the class you want to spawn. The first might be this or something else that determines its lifetime.