change object material unity
Code Example - change object material unity
Material[] materials = meshRenderer.materials;
Material oldMaterial = materials[0];
Material[] newMaterials = new Material[] { SphereMaterial};
meshRenderer.materials = newMaterials;
change physics material unity
Collider coll = GetComponent<Collider>();
coll.material.dynamicFriction = dynFriction;
coll.material.staticFriction = statFriction;