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

# Unreal Game Sync with Diversion

> Use Unreal Game Sync (UGS) on a Diversion repository: sync to a commit, filter what you sync, and pull precompiled editor binaries

> [card] Research Preview
>
> Unreal Game Sync for Diversion is a research preview and is available to selected
> studios only. Behaviour may change before general availability. To request
> access, contact [support@diversion.dev](mailto:support@diversion.dev).

Unreal Game Sync (UGS) is Epic's tool for keeping a team on a known-good build of a source-built engine: pick a change, sync to it, and get editor binaries that match it without compiling.

The Diversion build of UGS is the same application, connected to Diversion instead of Perforce. Your team keeps the UGS workflow it knows, and the repository, history and files live in Diversion.

> [!NOTE]
>
> If you only need to hand precompiled binaries to your team, Diversion can do
> that without UGS. See
> [Binary distribution for Unreal Engine](./binary-distribution).

## How UGS concepts map to Diversion

| In UGS | In Diversion |
| - | - |
| Changelist | Commit. The changelist number is the commit number. |
| Stream | Branch, written as `//<RepoName>/<BranchName>` |
| Workspace (client) | Diversion workspace |
| Precompiled binaries archive | A zip committed to a dedicated branch of the same repository |

## Prerequisites

* **Windows.**
* **The Diversion desktop app installed and signed in** on every machine that runs UGS. See the [Quickstart](https://docs.diversion.dev/quickstart.md).
* **The Unreal Engine source and your project in one Diversion repository.** See [Import Unreal Engine source](./ue-source-import).
* **The Diversion build of UGS.** Contact [support@diversion.dev](mailto:support@diversion.dev) to receive it.

## Prepare the repository

Do this once per repository, on any machine, and commit the result.

### Ignore the files UGS and the editor create

UGS keeps its own state in a `.ugs` folder at the workspace root, and the editor writes build output and caches into the project. None of it belongs in the repository. Add these rules to the `.dvignore` at the repository root:

```gitignore theme={null}
.ugs/
/Engine/Build/PrecompiledBinaries.txt
**/Content/Developers/
/[^Ee]*/**/Binaries/
/[Ee][^Nn]*/**/Binaries/
/[Ee][Nn][^Gg]*/**/Binaries/
/[Ee][Nn][Gg][^Ii]*/**/Binaries/
/[Ee][Nn][Gg][Ii][^Nn]*/**/Binaries/
/[Ee][Nn][Gg][Ii][Nn][^Ee]*/**/Binaries/
/[Ee][Nn][Gg][Ii][Nn][Ee]?*/**/Binaries/
/[^Ee]*/**/DerivedDataCache/
/[Ee][^Nn]*/**/DerivedDataCache/
/[Ee][Nn][^Gg]*/**/DerivedDataCache/
/[Ee][Nn][Gg][^Ii]*/**/DerivedDataCache/
/[Ee][Nn][Gg][Ii][^Nn]*/**/DerivedDataCache/
/[Ee][Nn][Gg][Ii][Nn][^Ee]*/**/DerivedDataCache/
/[Ee][Nn][Gg][Ii][Nn][Ee]?*/**/DerivedDataCache/
/Engine/Platforms/*/Binaries/
/Engine/Source/Programs/AutomationTool/bin/
```

The `Binaries` and `DerivedDataCache` rules cover every top-level folder except `Engine`. The engine folder is left to Unreal's own `.gitignore`, which Diversion also reads and which keeps some engine binaries tracked on purpose.

New ignore rules take effect after Diversion finishes its next scan of the workspace. On a full engine tree that can take several minutes.

### Tell UGS where the precompiled binaries are

Skip this step if your team compiles the editor locally.

UGS reads the location of the binaries zip from `Build/UnrealGameSync.ini` in your project folder. Add a section named after the project's path in the repository:

```ini theme={null}
[//<RepoName>/<BranchName>/<path to project>/<Project>.uproject]
ZippedBinariesPath=//<RepoName>/Dev-Binaries/++<RepoName>+<BranchName>-Editor.zip
```

`Dev-Binaries` is the default name of the branch the build machine publishes to. Keep it unless you pass a different branch to the build script, and use the same name in both places. See [Publish precompiled binaries](#publish-precompiled-binaries).

## Open your project in UGS

**1. Clone the repository with Diversion**

Create the workspace with the Diversion app or `dv clone`, and wait for the
first sync to finish. See [Get an existing project](https://docs.diversion.dev/basic/get-existing-project.md).

**2. Open the project file**

Start UGS. In the **Open Project** window, select **Local File**, click
**Browse...**, and choose the `.uproject` file inside the workspace.

**3. Sync**

UGS lists the commits of the workspace's branch, newest first. Double-click
a change to sync to it.

Open one workspace per UGS window. See [Not available in the research preview](#not-available-in-the-research-preview).

## Syncing

### Sync

**Sync** moves the whole workspace to the commit you picked, forwards or backwards. Afterwards the workspace is detached from its branch, even at the latest commit. This is deliberate: Diversion moves a workspace that is on a branch forward as soon as someone commits, and files would change under UGS and the editor.

Because a sync replaces the workspace's files, UGS refuses to sync while you have uncommitted edits. The message gives the number of files and names the first five:

```text theme={null}
The Diversion workspace has uncommitted changes in N file(s): [file names] and M more. Commit, shelve or revert them in Diversion before syncing.
```

The full list is in the workspace's pending changes in Diversion.

Commit, shelve or reset those changes in Diversion, then sync again. Files you added and never committed are kept.

### Sync (Just This Change) and Sync (Just Content)

* **Sync (Just This Change)** brings only the files of that one change to their version at that change. The workspace stays at its current commit. UGS offers it for changes newer than the one you are on.
* **Sync (Just Content)** syncs to the change but leaves shader source files (`.usf`, `.ush`) at their current version, so the editor binaries you already have keep working. Use it for a change that UGS shows as having no binaries yet.

In both cases the files that differ from the workspace's commit show up in Diversion as pending changes, next to any changes of your own. **Do not commit or reset them.** The next full **Sync** to a change that includes them clears them. See [What you will see in Diversion](#what-you-will-see-in-diversion).

### Sync filter

**Sync Filter...** in the **Options** menu works as in Perforce: excluded categories are removed from disk, and including a category again brings its files back. The excluded files show in Diversion as pending deletes for as long as the filter excludes them. Do not commit them.

After a filter change UGS lists the whole workspace before it syncs. On a full engine tree this takes a few minutes.

### Clean Workspace

**Clean Workspace...** in the **Options** menu lists files that are on disk and not in the repository, and deletes the ones you tick. Diversion's own `.diversion` folder and the `.ugs` folder are never listed.

UGS also removes folders that end up empty. If such a folder is tracked in the repository, it shows in Diversion as a pending delete until your next sync to a different change, which restores it.

## What you will see in Diversion

A workspace used through UGS always shows a few pending changes that you did not make:

* `Engine/Build/Build.version`, which UGS rewrites after every sync.
* Files held back by **Sync (Just This Change)**, **Sync (Just Content)** or a sync filter.
* Empty folders removed by **Clean Workspace...**.

Leave them as they are. When you commit your own work from this workspace, select only your own files.

> [!NOTE]
>
> Two improvements are planned. Diversion will show the changes UGS made
> separately from your own, so they no longer mix in the pending changes list.
> And you will be able to commit from the commit UGS synced you to, with
> Diversion resolving your changes against the branch's latest commit.

## Publish precompiled binaries

A build machine compiles the editor for a commit, zips it, and commits the zip to a dedicated branch. UGS then offers those binaries for that change and for the content-only changes after it, exactly as with Perforce.

On the build machine, with the workspace on the branch you build from and no local changes:

```bat theme={null}
Engine\Build\BatchFiles\RunUAT.bat BuildGraph ^
  -Script=Engine/Build/Graph/Examples/BuildEditorAndToolsWithDiversion.xml ^
  -Target="Submit To Diversion For UGS" ^
  -set:EditorTarget=<YourEditorTarget> ^
  -set:UProjectPath=<absolute path to your .uproject> ^
  -set:ArchiveStream=//<RepoName>/Dev-Binaries
```

The script compiles the editor and tools, builds `Editor.zip`, creates the archive branch if it does not exist, and commits the zip there with a message that tells UGS which change it was built from.

`-set:ArchiveStream` names the archive branch. Leave it out and the script publishes to `Dev-Binaries`, the default. The branch in `ZippedBinariesPath` in `UnrealGameSync.ini` must be the same one.

`BuildEditorAndToolsWithDiversion.xml` and its helper `SubmitPCBToDiversion.bat` come with the Diversion build of UGS. Commit both to your repository under `Engine/Build/Graph/`.

On team machines, tick **Sync Precompiled Binaries** in UGS. A change that alters code and has no archive yet is greyed out until the build machine publishes one. Until then, **Sync (Just Content)** takes its content.

## Differences from Perforce

* **A sync is refused while you have uncommitted edits.** Perforce keeps files you have checked out; Diversion asks you to commit, shelve or reset first.
* **A sync waits for Diversion to finish scanning the workspace.** Diversion scans after an ignore-rule change and when it starts or updates itself. On a full engine tree a sync started during a scan can take several minutes longer than usual.

## Not available in the research preview

* **Creating a workspace from UGS.** The **New\...** button in the **Open Project** window answers:

  ```text theme={null}
  Creating a workspace from UGS is not enabled for Diversion. Clone the repository with Diversion, then open the project in UGS.
  ```

* **Switching streams from UGS.** UGS answers:

  ```text theme={null}
  Switching streams from UGS is not enabled for Diversion. Switch the workspace's branch in Diversion, then sync in UGS.
  ```

* **Shelved changes.** UGS shows none.

* **Cancelling an operation that is already running.** It finishes first.

* **Two projects from different workspaces in one UGS window.** Open one workspace at a time.

* **Deleting a workspace from UGS** only removes it from this machine's list. The files and the workspace in Diversion stay.

If your team depends on one of these, tell us at [support@diversion.dev](mailto:support@diversion.dev).

## Troubleshooting

**UGS reports that it could not read the pending changes.**

```text theme={null}
Could not read the pending changes of the Diversion workspace (...). Nothing was changed. Try again.
```

UGS checks your uncommitted changes before every sync, and stops if Diversion does not answer in time. Make sure Diversion is running and has finished syncing, then sync again.

**A sync stays on "Syncing" for many minutes.** Diversion is scanning the workspace. The sync continues by itself when the scan ends.

**A change is greyed out.** It changes code and no binaries have been published for it yet. Wait for the build machine, or use **Sync (Just Content)**.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.