Landscape surface type with edit layers enabled (non-destructible workflow)

Hi!

I’m having trouble getting the correct surface type (physic material) when the landscape has edit layers turned on, and painting is done in multiple layers. This is the Non-Destructive workflow that Unreal introduced a while ago.

image

This is the code for the line trace. Trace is correct and it’s hitting the landscape. But, the surface type is not always correct.

This setup it’s useful to spawn different footsteps sounds, different vfx, etc.

Create a landscape with 3 materials: Rocks, Grass, Dirt.

Correct cases:
Rock & Grass materials. These layers blend with “Weight blend” or “Height Blend”.
“No Weight Blend” is set to FALSE in the Landscape Layer file.

Incorrect cases:
Dirt.
“No Weight Blend” is set to TRUE in the Landscape Layer file.
I’ve checked with the debug viewmodes, and when painting this material in another layer the bottom is not removed. So in the same point of the landscape there are two materials painted. That’s OK, but the surface type from the line trace should be the one from the top layer.
This material is automatically painted by a spline that is a path to the player. Splines are set up in a different landscape layer reserved for splines. Painting manually also does not work.