> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate the GDK with a pre-4.26 Unreal Engine project

> Wire the XBOX GDK into Unreal Engine builds older than 4.26 by editing Build.cs, adding include and library paths manually, and launching with wdapp.

Use this topic if you are preparing your game for publishing to the Microsoft Store on PC, and your game uses a version of Unreal Engine earlier than 4.26.

## Using an earlier version of Unreal Engine (prior to version 4.26)

If you are using Unreal Engine version 4.26 or later, see [Get started with Unreal on PC](/build/gdk-and-engines/unreal/unreal).

If you are using Unreal Engine version 4.25 or earlier, and you cannot upgrade to version 4.26 or later, you can still integrate with key XBOX ecosystem experiences using the import libraries of the Gaming Runtime and the XBOX Services API (XSAPI).

These import libraries allow games to call into Gaming Runtime APIs and XSAPI directly, without having to add a GDK platform target to the game project.

### Add headers and import libraries for Gaming Runtime and XSAPI

1. Find the build file for your Unreal project: /Source/(ProjectName)/(ProjectName).Build.cs
2. Add the line below to define the **\_GAMING\_DESKTOP** macro
   ```csharp theme={null}
       PublicDefinitions.Add("_GAMING_DESKTOP");  // For Unreal 4.12 or earlier, use "Definitions.Add()" instead
   ```
3. Add the following include paths
   ```csharp theme={null}
       // Add the include path for Gaming Runtime
       PublicIncludePaths.Add(@"C:\Program Files (x86)\Microsoft GDK\241000\GRDK\GameKit\Include");
       // Add the include path for XSAPI
       PublicIncludePaths.Add(@"C:\Program Files (x86)\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\Include");
   ```

> For Microsoft GDK (June 2024) or earlier use: *C:\Program Files (x86)\Microsoft GDK\230300\GRDK\ExtensionLibraries\Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Include*

1. Add the following library paths for the import libraries
   ```csharp theme={null}
       // Add the import library for Gaming Runtime
       PublicAdditionalLibraries.Add(@"C:\Program Files (x86)\Microsoft GDK\241000\GRDK\GameKit\Lib\amd64\xgameruntime.lib");
       // Add the import library for XSAPI
       PublicAdditionalLibraries.Add(@"C:\Program Files (x86)\Microsoft GDK\241000\GRDK\ExtensionLibraries\Xbox.Services.API.C\Lib\Release\Microsoft.Xbox.Services.142.GDK.C.Thunks.lib");
   ```

> For Microsoft GDK (June 2024) or earlier use: *C:\Program Files (x86)\Microsoft GDK\230300\GRDK\ExtensionLibraries\Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.lib*

<Note>
  Include paths and library paths might be different on your machine depending on GDK version and install location.
</Note>

### Access Gaming Runtime and XSAPI from C++ code files

1. Determine where you would like to add the integration for things like sign-in and unlocking achievements
2. Add headers for Gaming Runtime and XSAPI
   ```cpp theme={null}
       // When using Unreal Engine 4.15 or later
       THIRD_PARTY_INCLUDES_START
       
       #include "XGameRuntimeInit.h" // For Gaming Runtime 
       #include "xsapi-c\services_c.h"  // For XSAPI
       // When using Unreal Engine 4.15 or later
       THIRD_PARTY_INCLUDES_END
   ```
3. Integrate with service calls. See examples below:

* How to: best practice to sign in a user
* Updating title-managed Achievements

### Creating a product in Partner Center

Before you can test XBOX services functionality or publish a game to the Microsoft Store, you need to create your XBOX services-enabled product in Partner Center. For more information about Partner Center, see Setting up an app or game in Partner Center, for Managed Partners.

### Create a MicrosoftGame.config file for your game

For the game to sign-in to XBOX services, you need to include a **MicrosoftGame.config** file in the game package and fill in the "MSAAppId" and "TitleId" fields with the values for the Partner Center project you created in the last step. The easiest way to create the config file is to use the [MicrosoftGame.config Editor](/build/core-features/common/game-config/MicrosoftGameConfig-Editor). For more information about the MicrosoftGame.config file, see [MicrosoftGame.config overview](/build/core-features/common/game-config/MicrosoftGameConfig-Overview).

<Note>
  Make sure that the MicrosoftGame.config file is placed in the same directory containing your game's primary executable file.
</Note>

### Create and register your game package

To sign-in to XBOX services from your game and test the service integration, you need to create a package and register it.

1. Access the packaging dialog box by selecting **File** > **Package Project** > **Windows** > **Windows (64-bit)**.
2. Choose a folder for the build output from the **File Explorer** dialog box, and then select **Select Folder**.
3. Launch your game with wdapp.
   ```cpp theme={null}
       wdapp launch {full path to the game's executable in the same directory containing the MicrosoftGame.Config file}
   ```
4. Alternatively, you can register the package with wdapp and then launch the game from Start menu.
   ```cpp theme={null}
       wdapp register {full path to the directory containing the MicrosoftGame.Config file}
   ```

<Note>
  Double clicking the executable directly will not work for the purpose of signing into XBOX services.
</Note>

## See also

[Troubleshooting sign-in and sandboxes](/services/xbox-services/develop/troubleshooting/live-troubleshoot-sandboxes)


## Related topics

- [Use the GDK with Unity, Unreal, and other engines](/build/gdk-and-engines/gdk-and-engines.md)
- [Integrate the PlayFab Unreal Engine Marketplace plugin](/services/playfab/multiplayer/networking/party-unreal-engine-oss-playfab-plugin-integration.md)
- [PlayFab Unreal GSDK Plugin Overview](/services/playfab/multiplayer/servers/server-sdks/unreal-gsdk/index.md)
- [Using older versions of Unreal Engine 4](/services/playfab/multiplayer/networking/party-unreal-engine-using-older-versions.md)
- [Use the GDK with Unreal Engine](/build/gdk-and-engines/unreal/unreal.md)
