Calling Blueprint Event from C++ code

Hi all,

i would like to call an event inside my HUD blueprint using C++.

So, basically, when the character take damage i want to remove some health from it and call the event UpdateHUD which redraw the hearts based on the health remaining. How can i achieve something like this?

float AScrollerGameCharacter::TakeDamage(float Damage, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser)
{
	this->Health--;
	return Damage;
}

i dont think you can call blueprint event from c++. the opposite is easy but i dont think there is even documentation about this.

It can be done but is a hack more than a solution. You should instead make a Blueprint Implementable or Native Event.

So… i’ve made some edits:

	UFUNCTION(BlueprintImplementableEvent)
		void UpdateHud();

Inside the Widget C++ parent class, and now i can correctly see the Event UpdateHud inside the UMG blueprint of the widget. But how can i call that event from another c++ class?

Nevermind, seems like i’ve fixed it with:

Inside the .h file:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerWidget)
class UScrollerGameWidget* Widget;

Inside the .cpp file:

	this->Widget->RedrawHud();

Nevermind, seems like i’ve fixed it with:

Inside the .h file:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PlayerWidget)
class UScrollerGameWidget* Widget;

Inside the .cpp file:

	this->Widget->RedrawHud();