Overview

In C++ you can declare a custom operator== to compare equality of arbitrary types. You can’t directly use it in blueprints.

For blueprint support, make a Blueprint Function Library with a function which does the equality comparison, and follows the patterns below:

  • The function name must be prefixed with EqualEqual_
  • If you want to compare two FMyType values, the function must be called EqualEqual_MyType (Do not include the F)

Following these conventions allows you to use the untyped equality nodes with your custom values similar to how many builtin types support it.

Note: There are a number of other patterns similar to this, such as NotEqual_. Check engine code for examples.

Code example

UFUNCTION(BlueprintPure, meta=(DisplayName = "Equal (MyType)", CompactNodeTitle="==", Keywords="== equal"))
static bool EqualEqual_MyType(const FMyType& A, const FMyType& B);