Notify Observer difference?

According to https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/NodeReference/Decorators/index.html this is the case:

On Result Change Reevaluate only when
the condition has changed.

On Value
Change Reevaluate only when the
observed Blackboard Key changes.

I tested OnValueChange and changed a value with EXACTLY the same value (through C++)

Blackboard->SetValueAsBool("Testing", true);
Blackboard->SetValueAsBool("Testing", true);

However, it does not abort. So I changed it to this:

Blackboard->SetValueAsBool("Testing", false);
Blackboard->SetValueAsBool("Testing", true);

Now it aborts… So OnValueChange only works if the result changed. So what is the difference between OnValueChange and OnResultChange then? They behave exactly the same. Or is it bugged?

Or does it only apply to Composite Decorators (because they can have value changes without result changes)? Nah this also makes no sense because otherwise the regular Decorators would not have this option at all right?

You understand how it works correctly. It was your test that was faulty. You set the value to the same value; therefore the BB Key didn’t actually change.

A better test (stolen from the video below):

  • Have a BBKey Player and two character actors (Guy1 and Guy2).
  • Query if Player isSet, with Observer aborts = Self.
  • If Notify Observer is onResultChange, the tree will abort when Player goes from being null, to being set to either Guy1 or Guy2, but it won’t run if Player = Guy1 and you change it to Guy2, because in both cases Player is still Set. (Just like in your test where you changed it from true to true)
  • Now if you notify onValueChanged, and you change Player from Guy1 to Guy2, it will abort because even though the result didn’t change (both cases are true) the value did change (from Guy1 to Guy2)

This video explains the difference extremely well, so watch it if you have time: WTF Is? AI: Blackboard Decorator Node in Unreal Engine 4 ( UE4 ) - YouTube I’ve time stamped where he discusses Observer Notify.

2 Likes