简体   繁体   中英

Custom Class Method in Blueprint

That is my first try codding C++ in UE4. So I follow this tutorial I realised all properties but realise class method going with trouble. So even if I add method in public part and add BlueprintCallable parameter and some custom category I still can't see this method in ue4 editor.

// AMyActor.h
#include "GameFramework/Actor.h"
#include "AMyActor.generated.h"

UCLASS()
class STUDY_API AAMyActor : public AActor
{
GENERATED_BODY()


public: 
    // Sets default values for this actor's properties
    AAMyActor();

    // methods
    UFUNCTION(BlueprintCallable, Category = Damage)
    void CalculateValues();
};





// AMyActor.cpp
#include "Study.h"
#include "AMyActor.h"

// Sets default values
AAMyActor::AAMyActor()
{
}
void AAMyActor::CalculateValues() {
     // some code ...
}

To use that actor class in the editor you need to add the BlueprintType keyword to the UCLASS macro:

UCLASS(BlueprintType)
class STUDY_API AAMyActor : public AActor
{
GENERATED_BODY()


public: 
    // Sets default values for this actor's properties
    AAMyActor();

    // methods
    UFUNCTION(BlueprintCallable, Category = Damage)
    void CalculateValues();
};

See this page for more info on exposing functionality to blueprint.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM