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"

Support reactive variable events?

Adding "event tick" in a lot of places just to pick up the fact that a variable of some sort occasionally changes value is not very efficient.

It is possible to insulate a variable and only allow updates through function calls, and then I can do "other things" in response to the variable changing value. However, this generally happens synchronously, unless I define my own event type, and post it to myself (or other listeners) within the "change variable" function. This is a lot of boilerplate, which for Blueprints is annoying both in the amount of clicking needed, and in the screen space it takes.

It would be swell if I could tag a variable with an event, such that if this variable changes value, that event is fired, for example at the conclusion of the tick during which the variable changed. (This will also coalesce multiple changes that happen in the same tick.) This would let me write more efficient code, that was purely reactive, without adding a mess of wiring and nodes and functions for each little variable I may want to pay attention to.

I have a feeling that adding this feature, while not zero work, shouldn't be TOO much work, and I think it would significantly move the needle on how efficient, easy, and slick development with Blueprints can be. (Something like it is already supported for network events, too, with OnRep)

Product Version: Not Selected
more ▼

asked Jun 12 '14 at 09:48 PM in Blueprint Scripting

avatar image

1.3k 48 42 88

avatar image porcelania Aug 12 '14 at 09:47 AM

Yes, I need such kind of node as well. I want an event fire once a boolean value change. Because I put this bool in a class BP and referenced it in many other class BP, I got several "place" which would change this bool vaule. If I need to fire an event when this bool value change I need to put an event node on each "place". If I have a node called "fire on value change", then I only need to put one node on on BP. Or I have to use per tick event to detect bool change.

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

2 answers: sort voted first

Change your variable's replication to RepNotify. This creates a function automatically called OnRep_Variable that is called every time your variable is changed. I would say just make your own named function for it, but if you use it already at too many places than I'd suggest this solution.

more ▼

answered Jul 23 '16 at 03:08 PM

avatar image

531 25 25 43

avatar image JesterDoobie420 Jan 17 '18 at 08:05 PM

Exact answer I was lookin for, with enough detail to make it useful this time!!! This gets asked a lot but no other answer I could find explained wtf "RepNotify" was or how to setup/use it to us noobs. much thanks man

avatar image jwatte Jan 18 '18 at 02:45 AM

While I appreciate the answer, this doesn't work for "local only" variables. If I can send the variable from the server, then RepNotify is great!

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

Events only give you illusion of asynchronous, in reality they still execute by main thread. General practice in C++ is to make a varbales private or protected and strictly use Get and Set functions, if you look on API this is convention that UE4 follows.

more ▼

answered Jul 23 '16 at 06:58 PM

avatar image

37.2k 936 172 1116

(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