0
0
Unityframework~8 mins

Platform-specific settings in Unity - Performance & Optimization

Choose your learning style9 modes available
Performance: Platform-specific settings
MEDIUM IMPACT
This affects how the game or app loads and runs on different devices, impacting load times and runtime efficiency.
Configuring graphics quality for different platforms
Unity
void Start() {
#if UNITY_IOS
  QualitySettings.SetQualityLevel(3); // Medium for iOS
#elif UNITY_ANDROID
  QualitySettings.SetQualityLevel(2); // Low for Android
#else
  QualitySettings.SetQualityLevel(5); // High for others
#endif
}
Sets quality based on platform capabilities, reducing load and runtime cost on weaker devices.
📈 Performance GainReduces load time by up to 3 seconds on mobile; smoother frame rates
Configuring graphics quality for different platforms
Unity
void Start() {
  QualitySettings.SetQualityLevel(5); // High quality for all platforms
}
Applying the highest quality settings on all platforms causes slow load times and poor performance on low-end devices.
📉 Performance CostIncreases load time by 2-3 seconds on low-end devices; causes frame drops during gameplay
Performance Comparison
PatternDOM OperationsReflowsPaint CostVerdict
High quality for all platformsN/AN/AHigh GPU load on weak devices[X] Bad
Platform-specific quality settingsN/AN/AOptimized GPU load per device[OK] Good
Rendering Pipeline
Platform-specific settings influence the initial loading and runtime rendering by adjusting quality and resource usage per device.
Loading
Runtime Rendering
Memory Usage
⚠️ BottleneckLoading stage due to heavy assets or settings on low-end devices
Optimization Tips
1Use conditional compilation (#if UNITY_*) to apply platform-specific settings.
2Avoid high-quality settings on low-end devices to prevent slow load and frame drops.
3Test performance on each target platform using Unity Profiler.
Performance Quiz - 3 Questions
Test your performance knowledge
Why should you use platform-specific settings in Unity?
ATo optimize performance and load times for each device
BTo make the game look the same on all devices
CTo increase the app size for all platforms
DTo disable graphics on all platforms
DevTools: Profiler
How to check: Open Unity Profiler, run the game on target platform, and observe CPU/GPU usage and frame rate.
What to look for: Look for high spikes in CPU/GPU usage and low frame rates indicating performance issues.