Using a C++ function with Blueprint - FString

I have written a code that returns an FString. I am trying to use it as a blueprint.

I used a code similar to the example on A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums

however the return value in my blue print (GetHappyMessage), returns an empty string when passing it to the SetText method of a TextRender component. It works only if I try to write a string manually into the SetText parameter.


#pragma once

#include “Kismet/BlueprintFunctionLibrary.h”
#include “ActionBlueprints.generated.h”


class UActionBlueprints : public UBlueprintFunctionLibrary
UFUNCTION(BluePrintCallable, Category = “ActionBluePrintLibrary”)
static FString GetHappyMessage();


---- ActionBluePrints.cpp-----

#include “ActionWorld.h”
#include “ActionBlueprints.h”

UActionBlueprints::UActionBlueprints(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)


FString UActionBlueprints::GetHappyMessage() {

return FString("JAAAAA!!!!");