UMeshComponent::SetMaterial not working properly

Branch: Latest 4.8 Release from GitHub

Build Version: Version: 4.8.2-0+++depot+UE4-Releases+4.8

Detailed description of issue: I have a skeletal mesh component with 8 material indexes and when i try to change one of them using c++ it always select same random material instead of one i gave him.

.h

UPROPERTY(EditDefaultsOnly, Category = "Materials")
UMaterialInterface * TestMaterial;

.cpp

Mesh->SetMaterial(6, TestMaterial);

Screenshots/Link to video:

function call to SetMaterial. You can see Material is called and is valid.

If i eject and look at that instance i see that 6th material is filled with Glass which is some random material i never referenced (not to be confused with M_Glass, which i use for other materials).

Hi

Thanks for report. I’ve assigned a member of our support staff to look into this issue, and they’ll let you know if they need any additional information.

This issue was my bad, i was calling SetMaterial on Mesh (only has 2 material channels) instead of Mesh2 (which is another skeletal mesh component with 8 material channels i have on same actor).