After upgrading to 4.15.1 (from 4.13.2), I noticed that every time I opened a level in the editor, it’d be immediately marked as having unsaved changes (and require checkout from Perforce). This is an unfortunate workflow issue, because typically my team doesn’t want to check out map files unless they’re needed for getting work done (due to exclusive checkout).
After some debugging I narrowed this down to the landscape grass. ALandscapeProxy::UpdateGrass always creates a new UHierarchicalInstancedStaticMeshComponent which ultimately leads to Modify() being called on the Landscape actor.
I attached a super quick and dirty project [(link)][2] that demonstrates the issue. I started with an empty project and added a landscape with some grass.
The only workarounds I’ve found are to disable grass via the console (grass.Enable 0), or to set the start and end cull distances on the grass type to 0 (which effectively disables the grass as well). If I use either workaround, I can load up my levels without being prompted to save them.
Oh, I don’t think I made it clear: to repro the issue, load up the GrassTest project I attached, and then load TestMap. Notice that the map gets flagged as dirty immediately. This doesn’t happen if you disable grass before loading the map.
I suspect this is an engine bug since I was able to easily reproduce it in an isolated test project.
This bug manifest itself in other complex ways. Loading another Sequence, then clicking on any actor from a sub level with grass will mark that level dirty, even though the level is Locked! “grass.Enable 0” indeed fixes the problem.
This is a serious quality issues triggering Save nags on some large committed levels that should not be touched… The Save system in Unreal is already fragile and hacky.
Rinbi found the exact programming error and practically solved the problem… Save the dirty state before Modify() with “auto Package = Actor.GetOutermost(); bool PackageChanged = Package->IsDirty();” and restore with “Package->SetDirtyFlag(PackageChanged);”
Can we please at least have a bug report entered we can vote on?
We’re still seeing this behaviour in 4.17.2 - the sublevel containing our landscape with a grasstype on it is marked dirty as soon as you move the camera into a new area of the map.
I’ve verified that grass.Enable 0 stops this happening.
Is there anything we need to do to levels/landscapes/materials/grasstypes created before 4.16 for this to be fixed?