Fixing UE5 Actors Disappearing when Building Lighting

, updated 13 May 2023 🔖 game-development ⏲️ 1 minute to read

This issue has been fixed in Unreal Engine 5.2.0. See the release announcement.

In Unreal Engine 5.1.0 and 5.1.1, if you create blueprint actors which contain lights, they will disappear when you try to build static lighting under certain circumstances:

This is due to the command MAP REBUILD ALLVISIBLE being run automatically by the editor (and this command is completely broken in 5.1.0 and 5.1.1 - try running it in the console). We need to find a way to stop this command being run.

Remove Lights from Blueprints

One option is to remove lights from your blueprints and move them to separate light actors. This may be quite a big effort depending on how much content you have.

Move Blueprints In-World

Instead of defining separate blueprint assets in your Content folder, move the actors containing lights in-world, so they are all defined individually by creating an actor, then adding components to it (not saved as a blueprint). These actors are not affected by the bug, but this again may be quite a big effort depending on how many actors you have.

Build Lighting Only

One way is to build only lighting, so that MAP REBUILD ALLVISIBLE is never run:

Remove BSP

The above workaround doesn't work if you have BSP in your scene because the command is still forced to run - see the code here for more information: EditorBuildUtils.cpp#L389-L407

If you get rid of all BSP in your scene, that will allow you to run "Build Lighting Only", and MAP REBUILD ALLVISIBLE will not run. Conveniently you can convert BSP to static meshes at the click of a button.

Code Workaround for BSP

Compile the engine from source and comment out the following line: EditorBuildUtils.cpp#L406. That should allow a lighting only build to work without geometry being rebuilt and the bug being triggered.

if( bBSPRebuildNeeded)
{
   // BSP export to lightmass relies on current BSP state
   // GUnrealEd->Exec( InWorld, TEXT("MAP REBUILD ALLVISIBLE") );
}

I ended up implementing this workaround and compiling the engine myself, as I needed to build lighting on a level with BSP and blueprints with light actors.

The following thread has a lot of info on this subject: https://forums.unrealengine.com/t/actors-bp-disapear-when-build-geometry-or-lighting-ue5-1-0/692183/6

🏷️ light actor blueprint bsp engine command workaround fix disappear unreal bug scene code editorbuildutils ue5

⬅️ Previous post: Fixing UE5 Level Sequence Assertion

➡️ Next post: Running Rocket Chat on a Raspberry Pi in 2023

🎲 Random post: Scam Warning

Comments

Please click here to load comments.