RealityKit – Import USD mesh and get material names

Hey

How can I get a name of material that is assigned to my USD mesh?

for mat in importedModel.model!.materials {
    print(mat)
    print(mat as? SimpleMaterial)
}

I'm getting mostly nil when trying to recast it. I want to re-configure all my materials upon import. But I can't do it without knowing what material is what.

Given that 15.0 got nice PBR ones, what would be the correct way to do it?

Materials loaded from a USD will be of type PhysicallyBasedMaterial (instead of SimpleMaterial).

There is currently no API to get the name of a material; you can submit an item on feedbackassistant to track progress on that.

RealityKit – Import USD mesh and get material names
 
 
Q