Hey,
I have a USplineComponent as an actor’s RootComponent.
On that actor I have tried to override:
OnConstruction
PostEditChangeProperty
PostEditChangeChainProperty
but they don’t fire when USplineComponent is modified(when I move the spline points).
**How do I get a function to fire when my USplineComponent is modified in the editor?
I’m using version 4.7.2 (do I need to update?)
**
I did this in blueprints and it worked fine.
If you’re interested in the code:
APath::APath(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
Path = CreateDefaultSubobject<USplineComponent>(TEXT("Path"));
RootComponent = Path;
// Create billboard
BillboardEnd = CreateDefaultSubobject<UBillboardComponent>(TEXT("BillboardEnd"));
BillboardEnd->AttachTo(RootComponent);
}
void APath::UpdateBillboard()
{
// Set billboard location
FVector Loc;
FVector Tang;
Path->GetLocalLocationAndTangentAtSplinePoint(Path->GetNumSplinePoints()-1, Loc, Tang);
BillboardEnd->SetRelativeLocation(Loc);
}
void APath::OnConstruction(const FTransform& Transform)
{
// Not triggered when Path(USplineComponent) is changed
UpdateBillboard();
// Super
Super::OnConstruction(Transform);
}
void APath::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
// Not triggered when Path(USplineComponent) is changed
UpdateBillboard();
Super::PostEditChangeProperty(PropertyChangedEvent);
}
void APath::PostEditChangeChainProperty(struct FPropertyChangedChainEvent& PropertyChangedEvent)
{
// Not triggered when Path(USplineComponent) is changed
UpdateBillboard();
Super::PostEditChangeChainProperty(PropertyChangedEvent);
}