Table of Contents
Disabling VSync in Unity for Performance Testing
Disabling VSync in Unity can be crucial for performance testing, particularly when you aim to benchmark your game’s performance or reduce input lag. Here’s how you can disable VSync in Unity:
1. Access Quality Settings
- In the Unity Editor, navigate to the top menu and select Edit > Project Settings > Quality.
- In the Quality Settings window, you’ll see different quality levels. You can set VSync options for each level.
2. Configure VSync Settings
Locate the VSync Count dropdown. Unity provides several options:
Immerse yourself in gaming and excitement!
- Don’t Sync: Effectively disables VSync, allowing your game to run at uncapped frame rates.
- Every V Blank: Limits the frame rate to the screen’s refresh rate (VSync on).
- Every Second V Blank: Limits the frame rate to half the screen’s refresh rate.
Set the VSync Count to Don’t Sync to disable VSync.
3. Considerations
- Frame Tearing: Be aware that disabling VSync can lead to screen tearing, where parts of multiple frames are displayed at once.
- Input Lag: Disabling VSync can reduce input lag as there’s no delay waiting for the next refresh cycle.
- Platform-Specific Settings: Ensure you test VSync settings on each target platform as behavior can differ.
4. Alternative: Use of Triple Buffering
If tearing is an issue, consider using triple buffering. It helps to provide smoother gameplay without completely disabling VSync, though this should be balanced as it can increase input latency.
5. Scripting VSync Control
For runtime adjustments, VSync can be controlled via scripts:
// C# script to disable VSync
QualitySettings.vSyncCount = 0;
This line sets the vSyncCount
to 0, turning VSync off.