Dynamic Material Instances not working after packaging

Hi, I’ve got a BP inside my level. Inside the blueprint there are many different planes to which I assign different Dynamic Material Instances.

I’ve got a function that changes the dynamic material’s images.

It works fine when I play in the level editor viewport, but when I package the game, the dynamic material doesn’t work (though, the material is assigned, because I see the sky texture that is the base material selected).


I’ve seen that there are two different Create Dynamic Material Instance nodes, but it doesn’t work with either.

Also I want to report a possible bug: I tried assigning a dynamic MI in the properties and then using getMaterial>castToDynamicMaterialInstance, but it breaks the level’s saving.

# output log
Can't save ../../Main.umap: Graph is linked to external private object MaterialInstanceEditorOnlyData /Game/selector_BP.selector_BP_C:fg_plane_GEN_VARIABLE.MaterialInstanceDynamic_1.MaterialInstanceDynamic_1EditorOnlyData

What is it that you are trying to cast to Texture here ?

image

Or maybe that check is simply going to False.

image

Hard to say without more information. We have no idea where/when those two graphs are executing.

Right, sorry… I’m taking all the textures in a certain folder from my project and iterate through them to select the one with a specific filename.

Through some debugging I found out that the problem is the Get Asset By Path node, that is returning an empty list when packed.

Could it be that since those textures aren’t referenced anywhere UE doesn’t pack them? How could I include them when packaging?

Yes that is most likely the problem.

You can force-cook the relevant folder to make its content available in shipping build even when not directly referenced :

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.