Watch another actor for changes
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.
asked Jul 18 '16 at 07:49 AM in Blueprint Scripting
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 !
answered Jul 18 '16 at 08:13 AM
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.
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.
answered Jul 19 '16 at 01:16 AM
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.
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.
Follow this question
Once you sign in you will be able to subscribe for any updates here