I need to pass a layer reference to my ActorComponent
script, I can pass a layer name but it’s a weak link so I want to pass a reference/pointer. I’ve tried this variant:
#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;
};
However, it doesn’t work: I still can’t drag my layer into the script property in editor.
How to declare it correctly?
P.S. I am a beginner in UE.