UBoxComponent SetBoxExtent make it invisible

When i use SetBoxExtent on a UBoxComponent, it seem to change extents in the outliner detail, and the overlaps trigger as they should, but the UBoxComponent goes invisible in the editor.
What am i missing?

Ladder.h:

UCLASS()
class OMICRON_API ALadder : public AActor
{
	GENERATED_BODY()
	
private:
	UPROPERTY(VisibleAnywhere, Category = "Components")
	class USceneComponent * SceneComponent;

	UPROPERTY(VisibleAnywhere, Category = "Components")
	class UBoxComponent * DetectionBox;

	UPROPERTY(EditAnywhere, Category = "Settings", Meta = (MakeEditWidget = true))
	FVector DetectionBoxSize = FVector(-10.0f, 10.0f, 100.0f);

public:	
	ALadder();

protected:
#if WITH_EDITOR 
	virtual void PostEditChangeProperty(FPropertyChangedEvent & PropertyChangedEvent);
#endif

	virtual void BeginPlay() override;

public:	
	virtual void Tick(float DeltaTime) override;

	UFUNCTION()
	void OnOverlapBegin(UPrimitiveComponent * OverlappedComp, AActor * OtherActor, UPrimitiveComponent * OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);

	UFUNCTION()
	void OnOverlapEnd(UPrimitiveComponent * OverlappedComp, AActor * OtherActor, UPrimitiveComponent * OtherComp, int32 OtherBodyIndex);

private:
	UFUNCTION()
	void UpdateLadder();
};

Ladder.cpp:

ALadder::ALadder()
{
	PrimaryActorTick.bCanEverTick = false;

	SceneComponent = CreateAbstractDefaultSubobject<USceneComponent>(TEXT("Scene Component"));
	RootComponent = SceneComponent;

	DetectionBox = CreateDefaultSubobject<UBoxComponent>(TEXT("Detection Box"));
	DetectionBox->AttachToComponent(SceneComponent, FAttachmentTransformRules::KeepRelativeTransform);
	DetectionBox->OnComponentBeginOverlap.AddDynamic(this, &ALadder::OnOverlapBegin);
	DetectionBox->OnComponentEndOverlap.AddDynamic(this, &ALadder::OnOverlapEnd);

	UpdateLadder();
}

#if WITH_EDITOR 
void ALadder::PostEditChangeProperty(FPropertyChangedEvent & PropertyChangedEvent)
{
	UpdateLadder();
}
#endif

void ALadder::BeginPlay()
{
	Super::BeginPlay();	
}

void ALadder::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
}

void ALadder::OnOverlapBegin(UPrimitiveComponent * OverlappedComp, AActor * OtherActor, UPrimitiveComponent * OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
	UE_LOG(LogTemp, Warning, TEXT("begin"));
}

void ALadder::OnOverlapEnd(UPrimitiveComponent * OverlappedComp, AActor * OtherActor, UPrimitiveComponent * OtherComp, int32 OtherBodyIndex)
{
	UE_LOG(LogTemp, Warning, TEXT("end"));
}

void ALadder::UpdateLadder()
{
	DetectionBox->SetBoxExtent(FVector(FMath::Abs(DetectionBoxSize.X), FMath::Abs(DetectionBoxSize.Y), FMath::Abs(DetectionBoxSize.Z / 2)), true);
	DetectionBox->SetRelativeLocation(FVector(0, 0, DetectionBoxSize.Z / 2));
}

I just noticed that if i use build on the level, the box shows again!
Strange, but not a solution!

Are you using HotReload?

I just realized i had forgot to call the Super in post edit change property! :slight_smile:

#if WITH_EDITOR 
void ALadder::PostEditChangeProperty(FPropertyChangedEvent & PropertyChangedEvent)
{
	Super::PostEditChangeProperty(PropertyChangedEvent);

	UpdateLadder();
}
#endif