I’m playing around with Mesh Terrain. I have a simple test rectangle with just couple of spline modifiers and a single brush modifier for some basic sculpting. Don’t mind the water, it doesn’t have the modifier component.
In editing mode everything seems fine, but when I use “Build Mesh Partition (force rebuild)” option and start PIE one of the generated quadrants is shifted. Even if I don’t touch the terrain in any way on consecutive rebuilds random quadrant is affected and it’s either the visual mesh or collision.
Any idea what could be wrong or how to fix it?
In editor:
In game (PIE):
Hello there @chrisaverage!
Checking around the community, and considering this is a new feature from 5.8, there are not many scenarios like the one you are encountering. Also, since it’s still in an experimental stage, the function is prone to cause unexpected results.
Now, what we know from Build Mesh Partition can be seen here:
I would start by checking the output log in engine, when the force rebuild is executed, and look for any warning tied to LogMeshTerrain or LogMeshPartition, that could lead us to what’s causing the issue.
Next, since you mentioned the problem affects a random section during consecutive rebuilds, UE probably has a lot of stale/corrupted transform data compiled. I would strongly suggest deleting the previous generated mesh in your Content Browser, before going for the next rebuild.
And clearing the project’s cache would be helpful as well. To do so, close UE, go to your project’s main directory, and delete folders Intermediate and Saved. After that, reopen the project, and test your build again.
Thanks for the suggestions. Unfortunately cleaning everything manually and rebuilding didn’t help and there was nothing useful in the logs.
But… after a lot more experiments and debugging I figured it out.
I’m using a WP transformer that applies a Data Layer asset to the generated actors. I’m then loading Data Layer assets at runtime. That works mostly fine, except I had the same Data Layer asset assigned to the terrain MeshPartition actor itself. Apparently when it’s setup like that there’s some race between which assets get loaded first and one of the terrain assets ends up not attached to the MeshPartition actor, and doesn’t have its parent transform as a result. As for why rebuilding changed which asset was affected I think it’s just because it reorders the generated assets and whichever happens to become first on the list races with the MeshPartition actor loading.
So for now I’m just not assigning any Data Layer asset to the MeshPartition actor. I’m not sure how big it is to always keep loaded, but if it becomes a problem I guess I could devise a scheme where via another Data Layer this actor always loads first.
Btw. for some reason, even though the Preview transformer has the same WP setup, the editor preview actors don’t get the Data Layer asset, so working with it in editor is kinda tedious.
I also get some compilation errors on cook (failed ensure), so the whole module seems quite wonky at the moment. I haven’t even got to use the interesting parts yet. Oh well, that’s what experimental means I guess 
Try keeping the area square?
It was an old limitation of the landscape. I bet you they used the underlying code is some other way… if so, I’d expect the same limitation…