Works in the Editor, Crashes When Packaged: “Assertion failed: IsInGameThread()” and Other Packaged-Only Bugs

Table of Contents

Unreal Engine 5.x. Updated November 2026. Written by the Algosyntax team.

Quick answer: if your packaged game closes a second or two after launch with Assertion failed: IsInGameThread(), look for code in an actor or component constructor that creates a material instance, for example SetMaterial() on a widget component. A packaged game builds level actors on a background loading thread, while the editor builds them on the game thread. That’s why it never crashed in the editor. Set the material without creating an instance in the constructor, for example through OverrideMaterials, and do anything that creates objects in BeginPlay.

The symptom

Our VR app’s packaged build opened its window and disappeared about two seconds later. The editor, VR Preview and Standalone Game from the editor never crashed. The crash log in the packaged game’s Saved/Logs folder said:

Assertion failed: IsInGameThread()

Why only the packaged game crashes

When a packaged game loads a level, it constructs the level’s actors on the async loading thread to load faster. In the editor, maps load on the game thread. Code in a constructor therefore runs on a different thread in each case.

Most constructor code is fine on either thread. Code that creates new objects isn’t. Ours was in a panel actor’s constructor:

// Crashes in a packaged build: SetMaterial creates a dynamic material instance right away.
PanelWidget->SetMaterial(0, PanelMaterial);

UWidgetComponent::SetMaterial immediately creates a dynamic material instance, and that’s only allowed on the game thread.

The fix

In the constructor, only store references and defaults. Here, write the material into the component’s override list, and the widget component builds its instance later on the game thread:

// Safe in a constructor: only stores the reference.
PanelWidget->OverrideMaterials.Reset();
PanelWidget->OverrideMaterials.Add(PanelMaterial);

The general rule: in constructors, create default subobjects and set values. Create material instances, spawn actors and bind to other objects in BeginPlay or PostInitializeComponents.

Constructor changes need a full build with the editor closed. Live Coding doesn’t update constructor defaults.

Other bugs that only showed up when packaging

Problem Why the editor didn’t show it Fix
Two modules define a log category with the same name Editor builds put each module in its own DLL. A packaged game is usually one executable, so the two definitions collide when linking. Give each module’s log category a unique name.
The Android build tries to compile a desktop-only plugin The plugin claims every platform but depends on a Windows-only module (ours depended on Movie Render Queue). Add a PlatformAllowList to that module in the .uplugin (for example Win64, Mac, Linux).
A level you travel to is missing in the packaged game The editor can load any map. Add every level to Project Settings > Packaging > List of maps to include in a packaged build, and set the Game Default Map.
“Failed to load” warning for a data asset The asset’s C++ class was deleted. The editor only warns. Delete or recreate the asset.

Two editor habits that cause “it worked yesterday” bugs

  • Compile and save Blueprints after changing their defaults. We set a class default on a widget Blueprint from a script without compiling it, and new instances still had the old value (None).
  • After changing struct defaults in C++, reset edited instances. Values someone saved in the Details panel override your new code defaults. Right-click the property and choose Reset to Default.

How to read a packaged crash quickly

  1. Package a Development build, not Shipping, so you get logs and the console.
  2. Open the newest log in the packaged game’s Saved/Logs folder (on Windows: <YourGame>/Saved/Logs next to the executable).
  3. Search for Assertion failed, Fatal error or Error:. The call stack under it names the function, which is usually enough to find the constructor or Blueprint at fault.

FAQ

Is it safe to call CreateDefaultSubobject in the constructor? Yes. That’s what the constructor is for. The problem is creating runtime objects such as material instances.

Can I just turn off async loading? Don’t. It’s what makes level loading fast. Move the code instead.

Related tutorials