Nanite skinned mesh does not respect disabled sections from skeletal mesh editor

Sections which are disabled on skeletal meshes still render when rendering skeletal meshes using nanite.

[Image Removed]

I have the following hotfix in engine code (NaniteResources.cpp:2469) which appears to fix the issue, though I am not sure if that is the correct way to go about it:

// If Section is hidden, do not cast shadow
MaterialSection.bHidden = MeshObject->IsMaterialHidden(FirstLODIndex, MaterialSection.MaterialIndex);

// CHANGED CODE
MaterialSection.bHidden |= MeshSection.bDisabled;
// END CHANGED CODE

// If the material is NULL, or isn't flagged for use with skeletal meshes, it will be replaced by the default material.
UMaterialInterface* ShadingMaterial = InMeshDesc.GetMaterial(MaterialSection.MaterialIndex);

Steps to Reproduce
* Import a skeletal mesh asset with multiple sections (for example one cloth simulation section)

* In LOD 0 > Sections right click on one of the sections and select “Disable” on the section

* Toggle on Nanite Settings > Enable Nanite Support and press the “Apply Changes” button

* Drag an instance of this skeletal mesh into the scene

* Notice that the disabled section still renders in nanite, but does not render in the skeletal mesh previewer (where nanite is disabled on the debug component)

Hi Ted,

Thank you for the great bug report. I have fixed this in UE5Main in CL 45797729

Cheers,

Graham