AActor::bIsEditorOnlyActor with Game View enabled behaves inconsistently for Nanite and non-Nanite static meshes

In editor, when Game View is toggled, the visibility of actors with AActor::bIsEditorOnlyActor set to true is toggled. This works correctly for non-Nanite static mesh actors but does not work for Nanite static mesh actors.

For non-Nanite static mesh actors, this is handled by this code in `FPrimitiveSceneProxy::IsShown`:

if (View->Family->EngineShowFlags.Game)
{
	if (DrawInAnyEditMode)
	{
		return false;
	}
}

The equivalent code does not seem to exist for Nanite static meshes though.

Thanks!

Steps to Reproduce

  1. Open a new empty map
  2. Add a nanite static mesh actor to the map
  3. Add a non-nanite static mesh actor to the map
  4. Enable “Is Editor Only Actor” on both actors
  5. Toggle Game View on/off (press G)

Observe that the visibility of the non-Nanite static mesh actor is toggled, while the Nanite static mesh actor remains visible.

Hello,

Unfortunately this issue has existed since 5.4 but hasn’t been prioritized yet. I’ve updated the issue so it will be visible publicly soon: https://issues.unrealengine.com/issue/UE-210913

The note on the internal issue suggests this can be fixed with the following code change (untested)

// in FPrimitiveSceneProxy::FPrimitiveSceneProxy
 
DrawInGame &= !InProxyDesc.IsHidden();  
// change to
DrawInGame &= !InProxyDesc.IsHidden() && !InProxyDesc.bIsOwnerEditorOnly; 

Thanks Alex! We evaluated that change but ultimately decided against it for now. We’ll keep an eye on the bug for now, thanks again.