Settings API
The Settings API provides access to core application configuration and performance settings. It allows you to control application behavior, optimize performance for different hardware configurations, and adjust settings that affect the user experience.
Key Features
- Frame Rate Control: Manage FPS limits for performance optimization
- Real-time Updates: Changes take effect immediately without application restart
- Performance Optimization: Adjust settings based on hardware capabilities
- Power Management: Optimize for battery life or maximum performance
Functions
fpsLimit()
- Get the current frame rate limitsaveFpsLimit()
- Set the frame rate limit
Quick Example
// Check current FPS setting
const currentFps = await settings.fpsLimit();
console.log(`Current FPS limit: ${currentFps}`);
// Optimize for high-end hardware
await settings.saveFpsLimit(120);
// Optimize for battery life
await settings.saveFpsLimit(30);
// Dynamic adjustment based on conditions
const vrms = await Vrm.findAll();
const targetFps = vrms.length > 3 ? 30 : 60;
await settings.saveFpsLimit(targetFps);
Common Use Cases
- Performance Optimization: Adjust FPS based on scene complexity
- Battery Management: Lower FPS to extend battery life on mobile devices
- Display Matching: Match application FPS to display refresh rate
- Hardware Adaptation: Automatically adjust settings based on system capabilities
- Power Saving: Reduce rendering load during idle periods