Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: UE 4.12
more ▼

asked Jul 18 '16 at 07:49 AM in Blueprint Scripting

avatar image

13 3 4 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

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 !

more ▼

answered Jul 18 '16 at 08:13 AM

avatar image

769 26 6 43

avatar image baba147 Jul 18 '16 at 08:50 AM

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).

avatar image expose Jul 18 '16 at 10:15 AM

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?

avatar image baba147 Jul 18 '16 at 10:19 AM

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?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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. alt text

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.

alt text

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

capture.png (43.9 kB)
capture2.png (55.5 kB)
more ▼

answered Jul 19 '16 at 01:16 AM

avatar image

2.6k 98 16 97

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

alt text

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. alt text

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. alt text

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. alt text

In use: alt text

more ▼

answered Nov 28 '17 at 06:29 PM

avatar image

176 5 8 19

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question