我一直在尝试显示我在C ++类中创建的一些变量,然后基于该类创建一个Blueprint类。但是,当我看到对象的详细信息或尝试在“蓝图”中找到此变量时,它们不会显示。
我基本上已经从UE4文档中复制并粘贴了代码,请参见此处:https://docs.unrealengine.com/en-us/Programming/Introduction,但是这些变量对我而言并不显示。
// MyActor.cpp
#include "MyActor.h"
// Sets default values
AMyActor::AMyActor()
{
//PrimaryActorTick.bCanEverTick = true;
TotalDamage = 200.0f;
}
// Called when the game starts or when spawned
void AMyActor::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AMyActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// MyActor.h
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "MyActor.generated.h"
UCLASS()
class MYPROJECT3_API AMyActor : public AActor
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere)
float TotalDamage;
// Sets default values for this actor's properties
AMyActor();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};
我想从事件图中修改此变量。请帮助我找出我做错了什么,如果您需要更多信息,我们将很乐意为您提供信息。
答案 0 :(得分:2)
使用BlueprintReadWrite
或BlueprintReadOnly
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float TotalDamage;