Is there any way to fire an event on boolean value change?
I got a bool in my blueprint, I want to fire an event once the bool value changes. Is there anyway to create such an event? As I got several nodes in different place, all could change the bool value, so may be this kind of event could make BP looks pretty.
asked Aug 11 '14 at 05:04 PM in Using UE4
To fire an event when a value has changed, you have to know the old value, and check to see if it has changed.
To simplify doing this over and over I have a macro that I use to track if a value has changed.
This macro saves the setup value. Then every time you call the check, it will fire wither
To use this, I recommend calling the
Here is what is seen in the console, when I update the score a couple times.
By far the easiest and shortest way to achieve this is to add a XOR on the part of code where you evaluate your new boolean value. You don't need any extra variables or functions...just check if the new value differs from the one already stored in your boolean variable.
The SET itself and any code following it will only be executed ONCE when there is a change.
You can use a Custom Event node and call it using a Remote Event. Take a look at the screenshot below, this is a simple example of a Custom Event that is only activated when the bool is true.
Also take a look at our documentation on Custom Events.
answered Aug 11 '14 at 05:34 PM
TJ V ♦♦ STAFF
I have basically the same question, is it possible to call an Event whenever a boolean property of an instance placed in the world is changed? Basically binding a boolean to an event that runs everytime it changes.
i know it would be possible with c++ code (getter setter of the property) but i'm wondering if you could achieve this using Blueprints too.
Because i would like to call one or more events when the a Boolean changes, that way i could place a instance into the world and change the values of aBP instance from the editor without having to change the defaults of every BP and recompile everytime only because i wanted to test or see something.
answered Jun 15 '17 at 08:35 PM
Thanks for the anser but i meant more in the editor not while playing and the begin play event fires once the game started. Wanted to know if its possible to fire an event or bind a event that can fire while in Editor, I've seen theres a experimental function of the editor where you could have a button in the default properties that can be pressed while in Editor (not while starting or playing the game).
(This isn't taken from me, made a quick search for an example picture will link the original link of the thread below)
Haven't looked too much into it yet (because haven't much free time) but for my understanding this would fire an event from the blueprint while you are still in Editor and not playing, so with that you could easily change a boolean with a not node which inverts the boolean afterwards check the value of the boolean with a branch
(link of the picture https://forums.unrealengine.com/showthread.php?20934-Create-button-for-actor-interface)
answered Jun 25 '17 at 08:54 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here