It's a good idea to write as much of the logic for a game as isolated, non-MonoBehaviour classes that are easy to unit test in Edit Mode as possible. However, some of the logic in a game relates to things that happen when the game is running. Examples include physics, collisions, and timing-based events. We test these parts of our games in PlayMode.
In this recipe, we'll create one very simple PlayMode test to check that the physics affect a Rigidbody (based on an example from the Unity documentation):
Figure 13.25 – Running a physics PlayMode test