How to change default physics material via script,

119363-907b71a5-234e-4e22-ae3f-493e1e17e6fb.png

I want to change the value “Default Material” in PhysicsManager via script dynamicly. Is there a way?
Thanks!,

Here are the descriptions from Unity’s manual.

PhysicMaterial.PhysicMaterial Creates a new material.

PhysicMaterial Physics material describes how to handle colliding objects (friction, bounciness).

PhysicMaterial.bounceCombine Determines how the bounciness is combined.

PhysicMaterial.frictionCombine Determines how the friction is combined.

PhysicMaterial.staticFriction The friction coefficient used when an object is lying on a surface.

While you can’t swap out the PhysicMaterial object in the default settings through code, you can change the values of a PhysicMaterial object that’s already there.

So, for example, you can make a PhysicsMaterial called default_pm, set it as the default material in the project settings, and then change the values (friction, bounciness, etc.) of default_pm.

Also, new PhysicMaterial() creates exact copies of the default material, or, in the above example, copies of default_pm. This may be useful if you simply need to read the default material without changing it.