I’m currently using this code to delete the material that have been set in run time
but when I check the mesh Renderer inspector it keeps showing material.missing and not completely deleted from the element list
how can I delet it completely
Currently you don’t modify the materials array of the renderer at all. All you did is destroying the material it referenced. So the reference is still there but the material is essentially “dead”. The first line gets a copy of the material array. The second line destroys the first material in the array. The third line sets the first element of our array copy to null and the last line assigns the materials array back to the renderer. This should make it appear as “None” instead of “Missing”. Though it shouldn’t make a real difference.