Description

Using the AND and OR nodes in blueprints will evaluate the second argument even if the first is enough to pass/fail the condition.

Using the AND node where the first argument evaluates to false still checks the second. Using the OR node where the first argument evaluates to true still checks the second.

This behavior differs from C++ where AND (&&) and OR (||) will exit if the first argument satisfies the condition.

Steps to Reproduce
  1. Open UE4Editor (any project)
  2. Open Level blueprint
  3. Add 4 Functions that each return a bool (Func1, Func2, Func3, Func4)
  4. Add a print node to each function with a unique message
  5. Mark each function as Pure
  6. Set Func1 and Func2 to return True and set Func3 and Func4 to return False
  7. Add two key press nodes (T and Y) and wire each into a branch node
  8. Add AND node and wire into T branch - add OR node and wire into Y branch
  9. Wire Func3(False) into top of AND node input and Func1(True) into bottom
  10. Wire Func2(True) into top of OR node input and Func4(False) into bottom
  11. PIE and press T & Y

Result:
Pressing T will print both Func3 and Func1 even though Func3 being false means the condition fails (and doesn't need to check Func1)

Pressing Y will print both Func2 and Func4 even though Func2 being true means the condition passes (and doesn't need to check Func4)

Expected:
If the first condition meets the requirements for the expression, the second condition is ignored

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

76
Login to Vote

Won't Fix
ComponentUE - Gameplay - Blueprint
Affects Versions4.9.2
CreatedOct 12, 2015
ResolvedAug 18, 2021
UpdatedAug 18, 2021
View Jira Issue