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 callHeal, 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 withconst. Not exposed to Blueprint; works onconstobjects.BeginPlay- callsHeal(25.0f), then checksIsDead()and firesOnLevelUp().
The three flavors in one place
| Keyword | Body? | Blueprint sees | Generated |
|---|---|---|---|
func … BlueprintCallable | yes | callable | UFUNCTION(BlueprintCallable) |
func … BlueprintImplementableEvent | no | implementable graph | UFUNCTION(BlueprintImplementableEvent) |
method … const | yes | - | plain C++ method |
What to try
- In Blueprint, add a
Healnode 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.