A component called PlayerStamina has been added with version 4.3.

This component will be picked up automatically by the player movement, which will be unable to run if stamina reaches is depleted.

image.png

When the player runs, stamina will deplete at DepletionPerSecond rate.

Once player stamina fully depletes, you can optionally call DisallowDepletionForTime method, which will make the player unable to run for the specified time (3 seconds in the screenshot).

While the player isn’t running stamina will recover at RestorationPerSecond rate.

Enabling ShowDebug shows a small stamina bar when Gizmos are enabled in the GameView.

image.png