C++ 如何声明接受图层引用/指针的特性?
我需要向我的C++ 如何声明接受图层引用/指针的特性?,c++,unreal-engine4,C++,Unreal Engine4,我需要向我的ActorComponent脚本传递一个层引用,我可以传递一个层名称,但它是一个薄弱环节,所以我想传递一个引用/指针。我尝试过这种变体: #pragma once #include "CoreMinimal.h" #include "Layers/Layer.h" #include "Components/ActorComponent.h" #include "PlanetGravityActorComponen
ActorComponent
脚本传递一个层引用,我可以传递一个层名称,但它是一个薄弱环节,所以我想传递一个引用/指针。我尝试过这种变体:
#pragma once
#include "CoreMinimal.h"
#include "Layers/Layer.h"
#include "Components/ActorComponent.h"
#include "PlanetGravityActorComponent.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class JELLIANS_API UPlanetGravityActorComponent : public UActorComponent
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere)
float gravity = 10.0f;
UPROPERTY(EditAnywhere)
ULayer *layer;
public:
// Sets default values for this component's properties
UPlanetGravityActorComponent();
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
};
但是,它不起作用:我仍然无法在编辑器中将我的层拖动到脚本属性中
如何正确声明它?
p.S.我是UE的初学者