Skip to main content

03 - Functions & events

Covers the bread-and-butter: a BlueprintCallable function, a BlueprintImplementableEvent, and a plain const method.

Full source​

include "CoreMinimal.h"
include "GameFramework/Actor.h"

uclass AExampleFuncDemo : AActor meta: api=EXAMPLES_API
{
prop public float StartingHealth EditAnywhere BlueprintReadWrite category="Example" default=100.0f

func public void Heal(float Amount) BlueprintCallable category="Example" {
if (Amount <= 0.0f) { return; }
StartingHealth += Amount;
UE_LOG(LogTemp, Warning, TEXT("healed for: %f"), Amount);
}

func public void OnLevelUp() BlueprintImplementableEvent category="Example"

method public bool IsDead() const {
return StartingHealth <= 0.0f;
}

method public virtual void BeginPlay() override {
Super::BeginPlay();
Heal(25.0f);
if (IsDead())
{
OnLevelUp();
}
}
}

Line by line​

  • func public void Heal(float Amount) BlueprintCallable category="Example" { ... } - an RPC-style BlueprintCallable: any Blueprint can call Heal, and it has C++ logic (#!tps StartingHealth += Amount).
  • func public void OnLevelUp() BlueprintImplementableEvent category="Example" - an implementable event: no C++ body. Blueprints attach a graph to this event node. TPScript will reject a body here - that's by design.
  • method public bool IsDead() const - a plain C++ method with const. Not exposed to Blueprint; works on const objects.
  • BeginPlay - calls Heal(25.0f), then checks IsDead() and fires OnLevelUp().

The three flavors in one place​

KeywordBody?Blueprint seesGenerated
func … BlueprintCallableyescallableUFUNCTION(BlueprintCallable)
func … BlueprintImplementableEventnoimplementable graphUFUNCTION(BlueprintImplementableEvent)
method … constyes-plain C++ method

What to try​

  • In Blueprint, add a Heal node and call it - watch health go up and the log print.
  • Right-click the actor → Add Event → OnLevelUp to define the event's Blueprint behavior.
  • IsDead() is callable from C++ (if (IsDead()) ...) but not from Blueprint.

Next: 04 - Components.