Calling a C++ funtion from an ActorComponent in a Blueprint

Hello,

I’m writting some code in a class that inherits from ActorComponent. The idea is to make a helper. I’ve a some public function which are BlueprintCallable or BlueprintPure, but I can’t access them from my blueprint. This is my code:

UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class TESTUE_API UVRHelper : public UActorComponent
{
GENERATED_BODY()

public:
UVRHelper();

protected:
virtual void BeginPlay() override;

public:
UFUNCTION(BlueprintPure, Category=“VRHelper”)
FString GetDriverName();

UFUNCTION(BlueprintPure, Category="VRHelper")

int GetHandness();

UFUNCTION(BlueprintPure, Category="VRHelper")

bool IsHandConnected(bool left);

UFUNCTION(BlueprintCallable, Category="VRHelper")

void Recenter();
};

I’ve created a Blueprint that inherits from Pawn and then attached a VRHelper ActorComponent (this code so) on it. I want to call one of those functions but it doesn’t work.
Do you know why? I’m pretty new to C++ in Unreal, I probably made a mistake.

Thanks!

You need a variable to the Component to access those functions ( dropping component on graph )

Your code above should work. How exactly are you trying to call the functions? You need to get the component on to the graph and call it from there.

You need a pointer to an instance of your class in Blueprint. Either that or you’ve forgotten to compile.

@NedimH yes I’ve attached an instance of the component in my blueprint, then I drag it on the graph and try to call the function from it. But the functions don’t appear.
@DanteWingates I’ve already one. To compile I use the big compile button in the editor. Do I have to compile from Visual Studio too?

You have to close the editor then cleanup hotreload binaries and rebuild… Then open the editor again.

Great thanks!