Physics Material 2D
Unity also offers the possibility to create physics materials so as to adjust the friction and bounciness of a physical object when it collides with another one. In the case of 2D, this is enabled by the Physics Material 2D.
You can create a Physics Material 2D by selecting Assets | Create | Physics Material 2D from the top-bar menu as shown in the following screenshot:
Once selected in the project panel, we can tweak its two values in the Inspector, as shown here:
It's worthwhile mentioning that we have seen many variables during this chapter to assign a Physics Material 2D, and they are structured in a simple hierarchy:
If a Collider has a Physics Material 2D, this takes the priority and will be set to Collider.
If a Collider doesn't have a Physics Material 2D, then it will be assigned the one in the Rigidbody2D.
If even the Rigidbody2D doesn't have a Physics Material 2D, then the default Physics Material 2D will be assigned. The default Physics Material 2D can be set in...