UKismetMathLibrary::BooleanXOR
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns true only when exactly one of A or B is true (exclusive OR). Use to detect when two states differ, such as toggling or detecting state transitions.
Caveats & Gotchas
- • XOR is equivalent to NotEqual_BoolBool for booleans — both produce identical results. Prefer whichever name better communicates intent in the surrounding code.
- • Unlike AND and OR, XOR does not carry the CommutativeAssociativeBinaryOperator meta, so Blueprint will not auto-merge chained XOR nodes into a multi-input node.
Signature
static UE_INL_API bool BooleanXOR(bool A, bool B); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | bool | First boolean operand. | — |
| B | bool | Second boolean operand. | — |
Return Type
bool Example
Detect when exactly one player is ready C++
bool bOneReady = UKismetMathLibrary::BooleanXOR(bPlayer1Ready, bPlayer2Ready);
if (bOneReady)
{
ShowWaitingForOtherPlayerMessage();
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?