Setting variables during BeginPlay [Blueprint child of a C++ class ]

I have a C++ class named UQuestManager, and its blueprint child. My goal is to only ever use the blueprint child, but I want it to inherit functions written in C++ from its parent.

	UPROPERTY(BlueprintReadOnly, Category = Main)
	APawn* OwnerPawn;

UQuestManager’s virtual void BeginPlay() contains only a function called CacheOwner(). CacheOwner() sets OwnerPawn successfully and also prints “Debug!” to the screen.

The blueprint child uses UQuestManager’s BeginPlay().

When I run BP_QuestManager:


This results in printing “Debug!”, but does not print OwnerPawn.


When I run the CacheOwner directly, it prints “Debug!” twice, and prints OwnerPawn successfully.

Why is the inherited BeginPlay() not setting the child’s variable? I’ve technically ‘solved’ the issue, but I would like to better understand what is really happening and what the best practice in this situation is.

You need to add a call to the parent function in your Begin Play.

Unfortunately, this does not work. It prints “Debug!” once, but does not set OwnerPawn.