Build Configuration
The SDK uses conditional compilation with the USE_NUNU_SDK preprocessor directive to easily exclude it from builds. This ensures zero overhead in production builds.
Implementation Details
We use module-level compile definitions to exclude all SDK-related code from compilation, including both core SDK files and custom flayer functions.
When USE_NUNU_SDK is set to 0, the SDK functionality is disabled during compilation. When set to 1, all SDK code compiles normally and the SDK initializes with full functionality.
// NunuSDK.Build.cs
PublicDefinitions.Add($"USE_NUNU_SDK={(bUseNunuSDK ? "1" : "0")}");Editor Integration
In the Editor, you can fully configure the SDK’s build behavior by going to Edit → Project Settings → Plugins → NunuSDK
Here you can configure:
- Enable NunuSDK: Master toggle that enables or disables the SDK globally
- Always Enable in Editor: When checked, the SDK will always be enabled when running in the Editor, regardless of build configuration
- Enabled Build Configurations: Select which build configurations (Development, DebugGame, Debug, Test) should have the SDK enabled
These settings modify the Config/DefaultNunuSDK.ini file:
[/Script/NunuSDK.NunuSDKSettings]
bEnableNunuSDK=True
bAlwaysEnableInEditor=True
EnabledBuildConfigurations=(Development,DebugGame,Debug,Test)
ConsoleToggleChords=()
AdditionalLibraryComponentClasses=()Note: You most likely need to reload the project in your IDE to see the changes for the setting to take effect
Build Pipeline
For development builds, you can override the configuration using the USE_NUNU_SDK environment variable:
# Enable SDK for current session
set USE_NUNU_SDK=1
# Disable SDK for current session
set USE_NUNU_SDK=0Set this environment variable before building the project.
Decision Logic
The SDK uses the following logic to determine whether it should be enabled:
- If the
USE_NUNU_SDKenvironment variable is set, that value overrides all other settings - Otherwise, if the global
bEnableNunuSDKsetting is False, the SDK is disabled - If in Editor mode and
bAlwaysEnableInEditoris True, the SDK is enabled - If not in Editor mode, the SDK checks if the current build configuration is in the
EnabledBuildConfigurationslist