Is this a Bug? Materials don't show even though they should!

Hi there!

I’ve had this problem before. I wanted to make a post about it but then the problem resolved itself. I’ve created a new tree model for my scene and have applied the material correctly (it displays correctly in the editor).

However when starting the game and procedurally creating the trees, suddenly the material doesn’t show! After some time, and after creating a new blueprint to test it out again it suddenly worked but I didn’t really change anything…

The only Mesh that has a material applied to it in the left picture was a Static Mesh Component which I dragged into the scene with the Content Browser but all other are Hierarchical Instanced Static Mesh Components.

Now I have the same problem again with a new tree model and I am out of ideas… again it doesn’t apply the materials on my Hierarchical Instance Static Mesh Components and the trick I used last time didn’t work… could this be a bug or am I just missing something horribly?

Maybe someone can help me out, this is a really annoying issue…
Thanks a lot!

Could be simply you forgot to resave the material after using it for foliage. In the editor, the engine will detect this flag is needed and flip it for you and recompile as needed. if you launch the game without the editor, it only has access to the already precompiled shader permutations so when it sees the level asking to render it on foliage, it doesn’t have that shader so it simply fails.

look for a flag called “used with foliage” should be near the other flags on the material properties such as “used with static lighting” or “used with skeletal mesh” etc.

I know I’m very late with my answer but since now I didn’t get the chance to try it out.
The flag you mentioned was called “used with Instanced Static Meshes” and yes, it works now!

Thanks a lot!