When a designer changes the properties of an Actor
placed in the level, it is often important to show any visual results of that change immediately rather than just when the level is simulated or played.
When changes are made using the Details panels, there's a special event that the editor emits called PostEditChangeProperty
, which gives the class instance a chance to respond to the property being edited.
This recipe shows you how to handle PostEditChangeProperty
for immediate in-editor feedback.
Create a new
Actor
calledAPostEditChangePropertyActor
based onStaticMeshActor
.Add the following
UPROPERTY
to the class:UPROPERTY(EditAnywhere) bool ShowStaticMesh;
Add the following function definition:
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
Add the following to the class constructor:
auto MeshAsset = ConstructorHelpers::FObjectFinder<UStaticMesh>(TEXT("StaticMesh'/Engine...