Blog

Technical thoughts, troubleshooting, and development notes.

Blog/UE Development

Managing Configuration File Exclusion During Packaging

Staging inclusion and exclusion rules in DefaultGame.ini, along with configuration scanning, file writes, and cache reloads.

Back
This page's table of contents

UE: Managing Configuration File Exclusions During Packaging

Introduction

When packaging a UE project, the Config directory’s .ini configuration files are all included by default. In practice, however, there are some configuration files you do not want in the release build:

  • Debug configuration: Debug switches and profiling parameters used during development
  • Development environment configuration: Test server addresses and development keys
  • Private plugin configuration: Internal settings for certain plugins that do not need to ship with the package
  • Deployment to multiple environments: Test and production environments require different configuration sets

UE provides, in DefaultGame.ini, the [Staging] section to control how configuration files are packaged, but editing this file manually is tedious and error-prone—you need to remember the correct format (+AllowedConfigFiles / +DisallowedConfigFiles) and include the project name prefix.

The SimpleConfigExclude plugin makes this process visual, letting you work directly in the editor’s settings panel.


1. Core Features

1.1 Three-State Configuration Selector

The plugin provides three states for each configuration file:

StateMeaningEffect
DefaultDefaultFollows UE’s default behavior
AllowedForce inclusionEnsures that this configuration file is packaged
DisallowedForce exclusionEnsures that this configuration file is not packaged

In the Project Settings panel, each .ini file has a three-state toggle (SSegmentedControl) beside it. Click to switch states.

1.2 Automatic Scanning and Application

The plugin’s workflow is fully automated:

  1. On editor startup, automatically scan the Config directory for all .ini files
  2. Read existing rules from DefaultGame.ini, in its [Staging] section
  3. Generate a configuration list for display in the settings panel
  4. Apply changes immediately by writing to DefaultGame.ini as soon as a state changes

You do not need to edit any .ini files manually. The plugin handles all the details, including formatting, project name prefixes, and source control checkout.

1.3 Copy Excluded Files

After packaging, excluded configuration files will not appear in the package directory. In some scenarios, though, you may need to add certain configuration files manually afterward (for example, when deploying to different environments).

The plugin provides a one-click copy feature:

  • Configure the target directory (default: /Windows)
  • Click the Copy button
  • All configuration files marked Disallowed will be copied to the target directory
  • Optionally clean the target Config folder before copying

This is useful for deployment to multiple environments—package a clean base build, then add each environment’s configuration files as needed.

1.4 Safety Design

  • Hide the plugin’s own configuration: Hide DefaultSimpleConfigExclude.ini by default to prevent accidental loss of the plugin’s settings
  • Source control integration: Automatically check out DefaultGame.ini before modification (supports Perforce/Git)
  • Read-only protection: Automatically remove the read-only attribute when source control is not in use

2. How It Works

2.1 UE’s Staging Mechanism

When packaging, UE uses DefaultGame.ini and its [Staging] section to control the inclusion and exclusion of configuration files:

[Staging]
+AllowedConfigFiles=MyProject/Config/DefaultInput.ini
+DisallowedConfigFiles=MyProject/Config/DefaultDebug.ini

The plugin manages this section automatically, translating your visual operations into the correct ini format.

2.2 Scanning and Rule Synchronization

void USimpleConfigExcludeSettings::ScanAndUpdateConfigFiles()
{
    // 递归扫描 Config 目录下所有 .ini 文件
    IFileManager::Get().FindFilesRecursive(FoundIniFiles, *ConfigDir, TEXT("*.ini"), true, false);

    // 直接从文件读取 [Staging] section(不依赖 GConfig 缓存)
    // 解析 AllowedConfigFiles 和 DisallowedConfigFiles
    // 重建规则列表,匹配现有配置状态
}

Key point: The plugin reads file contents directly rather than relying on the GConfig cache, ensuring it always reads the latest state.

2.3 Applying Rules

void USimpleConfigExcludeSettings::ApplyExcludeRules()
{
    // 移除旧的 [Staging] 区段
    // 根据当前规则列表重新生成
    // 写回 DefaultGame.ini
    // 重新加载配置以保持状态一致
    GConfig->UnloadFile(IniFilePath);
    GConfig->LoadFile(IniFilePath);
}

After each state change, the plugin rewrites the entire [Staging] section and reloads the configuration, ensuring that the editor state and file contents match exactly.


3. Quick Start

Step 1: Install the Plugin

Copy the plugin folder into your project’s Plugins directory and restart the editor.

Step 2: Open the Settings Panel

Path: Edit > Project Settings > Plugins > Simple Config Exclude

The panel has three areas:

  1. Settings: General settings (whether to hide plugin configuration and clean the target directory before copying)
  2. Copy: Copy excluded files to a target directory
  3. Config Exclude Rules: Configuration file list and three-state selectors

Step 3: Configure Rules

  1. Find the configuration file you want to exclude
  2. Click Disallowed to exclude it
  3. Click Allowed for files you want to force into the package
  4. Changes take effect immediately; no additional save is required

Step 4: Package and Verify

Package the project as usual, then check the Config folder in the package directory to confirm that the excluded files are absent.


4. Use Cases

Scenario 1: Exclude Debug Configuration

The project has a DefaultDebug.ini file storing debug parameters that are not needed in production:

DefaultDebug.ini → Disallowed

Scenario 2: Deploy to Multiple Environments

1. 将测试环境配置标记为 Disallowed
2. 打包得到干净的基础版本
3. 用 Copy 功能将排除的配置复制到测试环境部署目录
4. 生产环境使用打包后的默认配置

Scenario 3: Protect Sensitive Configuration

DefaultEncryption.ini → Disallowed  // 密钥配置不随包发布
DefaultServer.ini → Disallowed      // 服务器配置通过运维单独部署

5. Getting the Plugin

Supported versions: Unreal Engine 5.2+

How to get it: Search for SimpleConfigExclude on the Fab store

Feel free to discuss any questions in the comments.


Summary

SimpleConfigExclude turns configuration file management during UE packaging from manual ini editing into visual operations:

  • Three-state selector: Default / Allowed / Disallowed; click to switch
  • Automatic scanning: Automatically discover all configuration files on editor startup
  • Immediate application: Write changes to DefaultGame.ini immediately
  • One-click copy: Copy excluded files to a specified directory for deployment to multiple environments
  • Safety design: Hide the plugin’s own configuration and automatically check out source-controlled files

There is no need to edit the [Staging] section manually anymore.


Thanks for reading. Feel free to like, follow, or bookmark this article, and discuss any questions in the comments.
If this article helped you, click here to donate and support the author.