- Allow myself to bump it as it is the first result on Google and I keep searching for it -
C++
Option 1 (Cleaner, Recommended):
#include "Misc/EngineVersionComparison.h"
// Can use
UE_VERSION_NEWER_THAN_OR_EQUAL
UE_VERSION_NEWER_THAN
UE_VERSION_OLDER_THAN
// Example:
#if UE_VERSION_NEWER_THAN_OR_EQUAL(5, 8, 0)
// >= 5.8.0
#endif
#if UE_VERSION_NEWER_THAN(5, 3, 0)
// >5.3.0 only code
#endif
#if UE_VERSION_OLDER_THAN(5, 3, 0)
// <5.3.0 only code
#endif
Option2:
#include "Runtime/Launch/Resources/Version.h"
// Then can access the following macros:
ENGINE_MAJOR_VERSION // 5
ENGINE_MINOR_VERSION // 8
ENGINE_PATCH_VERSION // 0