While this book focuses on C++, when developing with Unreal, a more standard workflow is to implement core gameplay functionality as well as performance-critical code in C++, and expose those features to Blueprint to allow designers to prototype gameplay, which can then be refactored by programmers with additional Blueprint features, or pushed back down to the C++ layer.
One of the most common tasks, then, is to mark up our classes and structs in such a way that they are visible to the Blueprint system.
Actor
class using the editor wizard; call it BaseEnemy
.UPROPERTY
to the class:UPROPERTY() FString WeaponName; UPROPERTY() int32 MaximumHealth;
UCLASS
macro:UCLASS(Blueprintable) class UE4COOKBOOK_API ABaseEnemy : public AActor
BaseEnemyclass
as the parent.EnemyGoblin
and open it in the Blueprint editor.UPROPERTY
macro we created earlier still aren't there because we haven't yet included the appropriate markup for them to be visible to Blueprint.BlueprintType
as a class specifier. BlueprintType
allows the type to be used as a type within the Blueprint editor (that is, it can be a variable or a function input/return value).Actor
, for example).Blueprintable
as a class specifier. Blueprintable
means a developer can mark a class as inheritable by the Blueprint classes.BlueprintType
and Blueprintable
instead of a single combined specifier, because sometimes, you may only want partial functionality. For example, certain classes should be usable as variables, but performance reasons forbid creating them in Blueprint. In that instance, you would use BlueprintType
rather than both specifiers.Actor
blueprints. It is recommended to use Blueprintable
, but omit BlueprintType
in this case.Blueprintable
or BlueprintType
specifies anything about the member functions or member variables contained inside our class. We'll make those available in later recipes.18.119.138.123