Watch another actor for changes

maybe you can store a reference of your actor A in your actor B , so you can cast to actor A in actor B when the construct is done. can you precise a bit more what you want to do please?
thanks !

Hi,

I have one actor (Actor A) blueprint which depends on another actor variable (Actor B) for it’s own construction. Currently, everything is happening in construction script of Actor A. When I change a property on my actor A, it’s re-constructed fine. However, when I make changes to Actor B, the dependent Actor A doesn’t get reconstructed automatically. Is there a way to solve this? Actor A should know when Actor B has changed so it can run its construction script again.

The construction won’t change while game is running, so it doesn’t need to happen on event tick.

Actually, Actor A is a blueprint which creates an array of meshes along a spline. To be able to re-use same spline for different arrays, I have an Actor B in scene which contains the spline component. Actor A references this spline in Actor B. Now as I manipulate this spline, Actor A doesn’t get updated until I go into Actor A properties and just change a property to trigger construction script.

edit: I can’t refer Actor A in Actor B because there can be multiple actors depending on Actor B (not only Actor A, so I will have to refer them all if I do that).

Spline is modified in editor by dragging points. Is there a way to raise an event when an actor or spline component is changed?

Or as last resort, raise an event on Actor B when it is selected and mouse is moved (so changes in Actor B will reflect in Actor A “as-they-happen”). But it has to capture editor mouse events (not simulation events)

edit: There is a PostEditChangeProperty in C++ for this. Is there any equivalent in BP?

can’t you bind an event on the function in wich you modify the spline? so that when you modify it, it will call that function in actor A?

It is not automatic but you could use an editor function in the spline to make code run at editor time.

Create a new CustomEvent in your blueprint and on the event’s settings check the CallInEditor.

99054-capture.png

Now you can run this event at editor time if you select the blueprint instance in the level and go down to Blutilities. Click the dropdown and select your function. Click Run next to it to run it.

Should be able to figure out how to get a reference to the actors you want to run functionality you need.

In my instance, I had a spawnpoint that needed to draw an arrow in-editor to a connected patrol point, and did so in the construction script. This worked fine when I edited the spawnpoint, but it wouldn’t see the change if I moved the connected control point.

What I did to resolve this was to encapsulate the operation that drew the connection line into a function called UpdateConstructionTasks, and made it callable in-editor. It’s called by the construction script, and also by a custom event called UpdateConstruction.

221807-updateconstructionevent.jpg

In the patrol point’s own UpdateConstructionTasks method, I have it iterate through the spawnpoints and patrol points in the level and call UpdateConstruction on each actor that has itself as its next waypoint.

And it draws an arrow to its next waypoint as well. UpdateConstructionTasks again is called both by the ConstructionScript, and also by an editor-callable UpdateConstruction event.

In use: