Preferences class provides a centralized store for user-configurable, globally relevant settings. All preferences are automatically persisted to the save file.
Overview
Preferences manages settings such as:- Display settings (framerate, VSync, debug display)
- Gameplay settings (downscroll, flashing lights, camera zoom)
- Accessibility options (naughtyness filter, subtitles)
- Audio/visual offsets for input lag compensation
- Mobile-specific settings (haptics, screen timeout, controls)
Display Settings
framerate
Target frames per second for the game.- Web: Always returns 60 (cannot be changed)
- Mobile: Returns the device’s display refresh rate (minimum 60)
- Desktop: User-configurable (default: 60)
vsyncMode
VSync mode setting.WindowVSyncMode
default:"OFF"
Possible values:
OFF, ON, ADAPTIVEunlockedFramerate
Unlocks the framerate cap on web builds.Bool
default:"false"
Web only. Removes the requestAnimationFrame cap.
debugDisplay
Controls the debug FPS/memory counter visibility.DebugDisplayMode
default:"Off"
Possible values:
Off, On, AdvanceddebugDisplayBGOpacity
Background opacity for the debug display.Int
default:"50"
Value from 0-100 representing background opacity percentage.
Gameplay Settings
downscroll
Places the strumline at the bottom of the screen instead of the top.Bool
default:"false"
Desktop default: false. Mobile default: true.
flashingLights
Controls the intensity of flashing lights effects.Bool
default:"true"
When false, flashing lights in menus and gameplay are less intense.
zoomCamera
Enables camera zoom synchronized to the beat.Bool
default:"true"
When true, the camera bumps on beats during gameplay.
naughtyness
Controls whether explicit language is displayed.Bool
default:"true"
When false, filters explicit content. Always false if compiled with NO_FEATURE_NAUGHTYNESS.
subtitles
Enables subtitles during songs and cutscenes.Bool
default:"true"
When true, displays subtitles when available.
Audio/Visual Settings
globalOffset
Global audio offset to compensate for input lag.Int
default:"0"
Offset in milliseconds. Positive values make notes appear earlier.
strumlineBackgroundOpacity
Opacity of the background behind the notes.Int
default:"0"
Value from 0-100. 0 = transparent, 100 = fully opaque black.
System Settings
autoPause
Automatically pauses the game when tabbing out.Bool
default:"true"
When true, game pauses on focus loss. Always false on mobile.
autoFullscreen
Automatically launches in fullscreen on startup.Bool
default:"true"
When true, game starts in fullscreen mode.
Screenshot Settings
shouldHideMouse
Hides the mouse cursor when taking screenshots.Bool
default:"true"
When true, mouse cursor is hidden during screenshot capture.
fancyPreview
Shows a preview after taking a screenshot.Bool
default:"true"
When true, displays an animated preview of the screenshot.
previewOnSave
Only shows preview after the screenshot is successfully saved.Bool
default:"true"
When true, preview only appears after save completes.
Mobile Settings
These settings are only available when compiled with mobile support (#if mobile).
hapticsMode
Controls haptic feedback mode.HapticsMode
default:"All"
Possible values:
NONE, NOTES_ONLY, ALLhapticsIntensityMultiplier
Multiplier for haptic feedback intensity.Float
default:"1.0"
Multiplier for all haptic effects. Higher values = stronger vibration.
screenTimeout
Allows the device screen to sleep.Bool
default:"false"
When false, prevents screen from sleeping during gameplay.
controlsScheme
Control scheme for the hitbox on mobile.String
default:"Arrows"
Control layout type. Default is arrow key layout.
Initialization
init()
Initializes preferences and applies saved settings.- Applies the autoPause setting
- Sets up the debug display
- Configures framerate caps
- Sets mobile-specific options
Example: Settings Menu
Example: Performance Optimization
Best Practices
Auto-Save
Preferences automatically save when changed. No manual save call needed:Platform-Specific Settings
Check platform before setting platform-specific preferences:Validation
Validate user input when allowing custom values:See Also
- Conductor - Uses globalOffset for timing
