In PlayerReferences.cs replace BoxCollider2D with CapsuleCollider2D as follows.

public BoxCollider2D PBC { get; private set; } // Replace this
public CapsuleCollider2D PBC { get; private set; } // With this
PBC = GetComponent<BoxCollider2D>(); // Replace this
PBC = GetComponent<CapsuleCollider2D>(); // With this

In PlayerCrouchIdleState.cs and PlayerCrouchMoveState.cs change the following. There is already a CapsuleCast which is commented in the code, uncomment it. Try using Control + F to search for the code if you are unable to find it.

// Comment this line below
_uncrouchCheck = Physics2D.BoxCast(new Vector2(_player.transform.position.x + _playerData.CrouchBoxColliderOffset.x, _player.transform.position.y + _playerData.StandBoxColliderOffset.y), new Vector2(_playerData.CrouchBoxColliderSize.x, _playerData.StandBoxColliderSize.y) - _playerData.UncrouchCheckShrink, 0f, Vector2.zero, 0, _playerData.CantExistIn);
 
// Uncomment the line below
// _uncrouchCheck = Physics2D.CapsuleCast(new Vector2(_player.transform.position.x + _playerData.CrouchBoxColliderOffset.x, _player.transform.position.y + _playerData.StandBoxColliderOffset.y), new Vector2(_playerData.CrouchBoxColliderSize.x, _playerData.StandBoxColliderSize.y) - _playerData.UncrouchCheckShrink, CapsuleDirection2D.Vertical, 0f, Vector2.zero, 0, _playerData.CantExistIn);
// Comment this line below
_uncrouchCheck = Physics2D.BoxCast(new Vector2(_player.transform.position.x, _player.transform.position.y) + _playerData.StandBoxColliderOffset, _playerData.StandBoxColliderSize - _playerData.UncrouchCheckShrink, 0f, Vector2.zero, 0, _playerData.CantExistIn);
 
// Uncomment the line below
//_uncrouchCheck = Physics2D.CapsuleCast(new Vector2(_player.transform.position.x, _player.transform.position.y) + _playerData.StandBoxColliderOffset, _playerData.StandBoxColliderSize - _playerData.UncrouchCheckShrink, CapsuleDirection2D.Vertical, 0f, Vector2.zero, 0, _playerData.CantExistIn);

In PlayerGroundedState.cs uncomment the correct section.

#region If using CapsuleCollider use this
 
// StickToGround = Physics2D.Raycast(new Vector2(_playerReferences.PBC.bounds.center.x, _playerReferences.PBC.bounds.center.y - _playerReferences.PBC.bounds.extents.y), Vector2.down, 2f, _playerData.GroundLayerMask);
// if (StickToGround.distance > 0.05) { _playerReferences.PRB.velocity -= new Vector2(0, _playerData.AntiBounceForce); }
 
#endregion
 
#region For BoxCollider
 
// Bottom Right Corner
StickToGround = Physics2D.Raycast(new Vector2(_playerReferences.PBC.bounds.center.x + _playerReferences.PBC.bounds.extents.x, _playerReferences.PBC.bounds.center.y - _playerReferences.PBC.bounds.extents.y), Vector2.down, 2f, _playerData.GroundLayerMask);
 
// Bottom Left Corner
StickToGround2 = Physics2D.Raycast(new Vector2(_playerReferences.PBC.bounds.center.x - _playerReferences.PBC.bounds.extents.x, _playerReferences.PBC.bounds.center.y - _playerReferences.PBC.bounds.extents.y), Vector2.down, 2f, _playerData.GroundLayerMask);
if (StickToGround.distance < StickToGround2.distance && StickToGround.distance > 0.05) { _playerReferences.PRB.velocity -= new Vector2(0, _playerData.AntiBounceForce); }
if (StickToGround2.distance < StickToGround.distance && StickToGround2.distance > 0.05) { _playerReferences.PRB.velocity -= new Vector2(0, _playerData.AntiBounceForce); }
 
#endregion

Replace theBoxCollider2D component with CapsuleCollider2D on the Player. Additionally, be sure to assign the correct Physics Material that was applied to the BoxCollider2D. Finally, adjust the collider sizes and assign them to PlayerData asset.

Note

PlayerChecks will still use BoxCast instead of CapsuleCast. Although this shouldn’t cause any issues, it’s straightforward to modify them since both are very similar. Refer to PlayerCrouchIdleState above to see the difference between the two methods.