[UE5.4] How to ensure materials are loaded on spawned actors?

When my game starts (tower defense), I have a screen that shows a preview of the towers you can unlock and stats on enemies. This is done with a capture camera. Unfortunately, the materials aren’t showing as can be seen here:

I’ve tried everything. I’ve tried making those assets primary assets and using the AssetManager. I’ve tried pre-spawning them in the permanent level. I’ve tried PrestreamTextures(). Nothing works.

Now, having said that… for the towers, by using AssetManager, pre-spawn and PrestreamTextures, only the first tower shown doesn’t have materials. If I change the displayed page (UI) and go back, it will display correctly. But almost good isn’t good enough.

With the enemies, they don’t have pre-spawn, but do use the AssetManager and PrestreamTextures and most of the enemies don’t have materials even after paging back in forth in the UI. So pre-spawning helps. But clearly I’m missing something.

There’s gotta be a way to fix this. Anyone know how to ensure the materials are displayed? Maybe it’s a compilation thing. Anyone have any ideas?

I have exactly the same problem. In my game I capture inventory item thumbnails (that need to be dynamic because of crafting) and capture component fails to render materials for some items (both in PIE and in packaged game). I can add that this happens even when material shaders are compiled (UMaterialInterface::IsComplete() returns “true”). It seems like it does not have much to do with texture streaming because it happens even for materials that do not use textures (just color parameters). This problem persists in UE 5.5 and UE 5.6 too, but not in UE 4. (I have older version of my project in UE 4 and capture component works just fine, never failing to render any materials for any item in inventory). Can someone please comment on this? What do we miss? Is it some setting for SceneCaptureComponent2D?

Hi, wanted to give an update on how I solved this. I have 3 different ways when spawning an actor.

  1. I set bCaptureEveryFrame to true when using the capture camera.

This lets the image update, but it does take a LOT more GPU processing power. Your framerate will potentially be cut in half. And your capture camera must be near your main camera or you will get flickering of shadows and other things as each camera is fighting for resources for their own views.

  1. If it’s a fullscreen UI, preload the assets in the viewport. The UI will hide everything behind it so you cannot see the assets, but it will load them all in. This only works if the user must take an action to show the asset in the UI. If the asset is displayed right away, you need option 1 or 3.

  2. Wait until HasActorBegunPlay() returns true.

If the actor is already in the level, I have another post where I indicate how to check if a level is loaded. It is somewhat complicated so HasActorBegunPlay() is probably easier.

Thanks for the update! I will try that.