Event to track USplineComponent shape modification

The actor I’m working on contains a USplineComponent and need to detect when its shape is changed. I want to be able to create a delegate and hook it to some dispatcher of the component. Example use case: the user manipulates the spline in the editor viewport. The spline notifies fires the update event and the actor regenerates some procedural mesh along the new shape of the spline.

So far I’ve tried to inherit for the USplineComponent and to add an event dispatcher to its propertie edited method:

void UMySplineComponent::PostEditChangeChainProperty(FPropertyChangedChainEvent& PropertyChangedEvent) {

And in the actor constructor:

spline->OnSplineChanged.BindUFunction(this, GET_FUNCTION_NAME_CHECKED(MyActor, OnSplineChanged));

Unfortunately this works only for the spline properties changes but not for its shape. I also tried to add custom USplineMetadata with a dipatcher inside but that works only for adding or deleting control points and not for their modifications.

Could you please point me to a direction to achieve that functional?

Hi @OlegGomozov !
Did you find any solution for this ? I’m looking for the same functionnality on my project.


A little known fact is that C++ actors by default only run construct for a select few operations. So you could in the Actor class enable this in the constructor. That will help with the dragging redrawing, and can poll some things conditionally in OnConstruction() of the actor.

this->bRunConstructionScriptOnDrag = 1;

Maybe try looking at UWaterSplineComponent in UE5. They are doing a similar thing in the class by firing a delegate in multiple areas to signify change.

It’s lightweight in some areas, but seems pretty complex in the way that they validate spline points…

1 Like

Thanks a lot @Rumzie for your response ! Yes finally my last researches drive me to the OnConstruction() method override, it gives me the results i’ve expected. I’ll definitively take a look at the UWaterSplineComponent to get more inspirations, thanks for the tip !

1 Like

I haven’t directly inherited from the spline component for my use cases because I’m usually using it in conjunction with splinemeshcomponents which are easier to manage using an actor as a container. And the default spline mesh has served my needs well except for weird gimbal locking issues which I’ve never been able to overcome completely.