๐งพ 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_VERSIONcomputes(ENGINE_MAJOR_VERSION * 100 + ENGINE_MINOR_VERSION)._HIGHERmacros expand to their arguments only when the engine is at or above the respective version._LOWERmacros expand when the engine is below the respective version._SWITCH(Before, AfterEqual)selectsAfterEqualwhen the engine is >= target, otherwiseBefore._ONLY(...)expands only for the exact version range.
๐ Common macros
GORGEOUS_ENGINE_VERSIONGORGEOUS_23_HIGHER,GORGEOUS_24_HIGHER, ...,GORGEOUS_56_HIGHERGORGEOUS_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_VERSIONandENGINE_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