How to get a return value from a blueprint actor function to C++?

Hello guys,

So, I’ve been trying to get adapt to UE4 C++. I’m making dummy projects to learn about different stuff. I have ran into a problem and would appreciate if someone helps me out.

So, I am inside the C++ Game mode and have an FTransform variable, say “SpawnPoint”.

Also, I have a Blueprint Actor say “Spawner” placed at various transforms in the level.

Now when the player spawns, he spawns randomly at any one of the Spawner. The Spawner has a BP Function that returns the attach point of the spawner in the world.

I am able to call the function from Game Mode to the spawner but I am not sure how to get and store the attach point transform to the spawn point variable. Kindly help.

SpawnPoint = Spawner->CallFunctionByNameWithArguments(TEXT(“GetAttachTransform”), debug, NULL, true);

This is the blueprint function

113481-untitled.png

You can create a class in c++ that has a BlueprintNativeEvent function like this:

UFUNCTION(BlueprintImplementableEvent)
FTransform GetAttachTransform();

and make a BP that derives from that class. Then inside the BP override the GetAttachTransform() function and call it through c++ with:

SpawnPoint = Spawner->GetAttachTransform();

Hi. Thanks for the reply.

I understand what you suggested and I think definetly you are correct.

Maybe my brain shut down after too much code. XD

Anyhow, thank you again for the reply.
Cheers mate.