You are viewing documentation for v1.1. Switch to current version โ†’

๐Ÿงพ Version Helper Macros

Short Description

Helper macros for conditional compilation based on the engine major/minor version.

Long Description

These macros encode the engine version into a single numeric value and provide convenient guards to include or exclude code for particular Unreal Engine releases (e.g. 5.1, 5.2). They also offer _SWITCH and _ONLY forms to select between implementations when the engine version matches or differs.

โš™๏ธ How it works

  • GORGEOUS_ENGINE_VERSION computes (ENGINE_MAJOR_VERSION * 100 + ENGINE_MINOR_VERSION).
  • _HIGHER macros expand to their arguments only when the engine is at or above the respective version.
  • _LOWER macros expand when the engine is below the respective version.
  • _SWITCH(Before, AfterEqual) selects AfterEqual when the engine is >= target, otherwise Before.
  • _ONLY(...) expands only for the exact version range.

๐Ÿš€ Common macros

  • GORGEOUS_ENGINE_VERSION
  • GORGEOUS_23_HIGHER, GORGEOUS_24_HIGHER, ..., GORGEOUS_56_HIGHER
  • GORGEOUS_51_LOWER, GORGEOUS_52_LOWER, ...
  • GORGEOUS_51_SWITCH(Before, AfterEqual), GORGEOUS_51_ONLY(...), etc.

๐Ÿ“š Usage Examples

// Include UE 5.2-only code
GORGEOUS_52_HIGHER(
    // code compiled when engine >= 5.2
)

// Choose between two implementations depending on the engine GORGEOUS_53_SWITCH( // fallback for older engines LegacyImplementation();, // implementation used for 5.3 and newer ModernImplementation(); ) ```

Notes

  • The macros are implemented in terms of engine-provided ENGINE_MAJOR_VERSION and ENGINE_MINOR_VERSION. They are intentionally conservative when supporting older engine branches.
  • Some type aliases (e.g. TObjectPtr) are also conditionally defined using these macros to normalize API differences across versions.

Where to find the header

src/content/gorgeous-core/RuntimeUtilities/Helpers/Headers/Macros/GorgeousVersionHelperMacros.h