Does anyone know if it’s possible to replace only one material on an object? If originally you have a model with two different materials on it? There seems to be no way to do it without overwriting the second material as well if you drag and drop a new material onto the object.
If you want to do it by script, you can just access the Renderer component’s material array.
void AssignMaterial(Material material, int index) {
if(GetComponent<Renderer>() == null) {
return;
}
Renderer renderer = GetComponent<Renderer>();
if(index >= renderer.materials.Length) {
return;
}
renderer.materials[index] = material;
}
If you want to do it in the inspector, then the materials should be listed in the Object’s Renderer Component (MeshRenderer most likely).