There are a few options but I think you want material_override
.
Other options are:
- material_overlay
- get_surface_override_material(int)
the 2nd one is useful if you want to change part of the mesh’s material, but it has to be created with multiple material slots.