【问题标题】:Custom Class Method in Blueprint蓝图中的自定义类方法
【发布时间】:2015-06-28 14:49:34
【问题描述】:

这是我第一次尝试在 UE4 中编写 C++。所以我关注this tutorial 我实现了所有属性,但实现了类方法遇到了麻烦。因此,即使我在公共部分添加方法并添加 BlueprintCallable 参数和一些自定义类别,我仍然无法在 ue4 编辑器中看到此方法。

// 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 ...
}

【问题讨论】:

    标签: c++ unreal-engine4


    【解决方案1】:

    要在编辑器中使用该角色类,您需要将 BlueprintType 关键字添加到 UCLASS 宏:

    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 了解更多关于向蓝图公开功能的信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-17
      • 2020-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多