Level class has a method called
SetGravity, which is responsible for taking the value of the gravity property and applying it to the Physics 2D settings in Unity. You don't need to take care about how this is implemented. The only thing we must to do is to integrate this in the custom inspector we created for the
Level class, so each time the gravity value changes, the
SetGravity method will take care of the rest.
Let's update the
LevelInspector class to achieve this. At the end of the
DrawLevelDataGUI method, add the following line of code: