menu_bookDocumentation

s&box GamePreferences: User preferences

calendar_today May 12, 2026 schedule ~1 min read person PatrickJr verified 50

GamePreferences Static Class

GamePreferences is a static class that defines the local user's preferences for the game. These ConVars control player-specific settings that are saved between sessions.

Console Variables

CSHARP
public static class GamePreferences
{
    [ConVar("sb.autoswitch", ConVarFlags.UserInfo | ConVarFlags.Saved)]
    public static bool AutoSwitch { get; set; } = true;

    [ConVar("sb.fastswitch", ConVarFlags.Saved)]
    public static bool FastSwitch { get; set; } = false;

    [ConVar("sb.viewbob", ConVarFlags.Saved)]
    [Group("Camera")]
    public static bool ViewBobbing { get; set; } = true;

    [ConVar("sb.screenshake", ConVarFlags.Saved)]
    [Range(0.1f, 2f), Step(0.1f), Group("Camera")]
    public static float Screenshake { get; set; } = 0.3f;
}

ConVar Descriptions

AutoSwitch

  • Console command: sb.autoswitch
  • Default: true
  • Enables automatic switching to better weapons on item pickup
  • UserInfo flag means it's a user-specific preference

FastSwitch

  • Console command: sb.fastswitch
  • Default: false
  • Enables fast switching between inventory weapons
  • Saved flag means it persists between sessions

ViewBobbing

  • Console command: sb.viewbob
  • Default: true
  • Enables camera view bobbing effect
  • Grouped under "Camera" settings

Screenshake

  • Console command: sb.screenshake
  • Default: 0.3f
  • Intensity of camera screenshake (0.1-2.0)
  • Grouped under "Camera" settings

Usage

CSHARP
// Enable fast weapon switching
GamePreferences.FastSwitch = true;

// Disable screenshake
GamePreferences.Screenshake = 0.1f;

// Enable via console
> sb.autoswitch 1
> sb.fastswitch 1
> sb.viewbob 0
> sb.screenshake 0.5

Notes

  • All ConVars are saved between sessions
  • AutoSwitch has UserInfo flag for user-specific settings
  • ViewBobbing and Screenshake are grouped under "Camera"
  • Screenshake has range and step constraints
  • Used for player preference persistence
Was this helpful?