Closed AgenteDog closed 5 years ago
For those curious, I ended up fixing it...
asset = ue.load_object(StaticMesh, location)
for index, material in enumerate(asset.StaticMaterials):
if material.MaterialSlotName == name:
component = ue.load_object(StaticMesh,location)
material = ue.load_object(Material, location)
component.set_material(index, material);
Hello brother, thank you very much for providing this discussion for my reference. I am using version UE4.18, but I encountered an error while using your above method:
uobject is not a UPrimitiveComponent
Traceback (most recent call last):
File "
Hey, so I have been trying to search but haven't been able to find anything. Is there a way to change the materials in a static mesh by material slot name?
As you can see in this image I have 4 material slots, and, I know already the names of these slots. Is there any way that I can replace/assign a material to a specified slot?
So if I want to change the material of the material slot number 3 (mtl_p6_tree_palm_date_cuts) I just specify stuff like the mesh, the material slot and the material that I want to assign.
If it is possible (I imagine that it is) how can I do it?