Hi!
I have this attribute:
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UPROPERTY(EditDefaultsOnly, Category = "Components")
TSoftObjectPtr<class ADoorLever> DoorLever;
Which I use here:
void ADoor::BeginPlay()
{
Super::BeginPlay();
if (DoorLever)
{
UDoorInteractionComponent* InteractionComp =
DoorLever->FindComponentByClass<UDoorInteractionComponent>();
if (InteractionComp)
{
UE_LOG(LogTemp, Warning, TEXT("[ ADoor::BeginPlay() ] : Get Interaction Component"));
InteractionComp->OnInteraction.BindUObject(this, &ADoor::HandleOnInteraction);
}
}
}
Do I really need to set the DoorLever
attribute as TSoftObjectPtr
?
I think I have copied and now I’m not sure if I really need to use TSoftObjectPtr
. Probably, the right choice is TObjectPtr
.
Thanks!