UFUNCTION() is useful because it is a C++ function that can be called from both your C++ client code as well as Blueprint diagrams. Any C++ function can be marked as a UFUNCTION().
Creating a UFUNCTION
How to do it...
- Construct a UClass class or a derived class (such as AActor) with a member function that you'd like to expose to Blueprints. Decorate that member function with UFUNCTION( BlueprintCallable, Category=SomeCategory) to make it callable from Blueprints.
- For example, let's create an Actor class called Warrior and use the following scripts for it:
//Warrior.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Warrior.generated.h"
UCLASS()
class CHAPTER_04_API...