Scripting with Adaptive Performance
Control and monitor device performance at runtime using the Adaptive Performance scripting API.
Read time 1 minuteLast updated 12 days ago
Control and monitor device performance at runtime using the Adaptive Performance scripting API.
After you set up Adaptive Performance, you can use its scripting API to access and control device performance metrics directly from your code. The central point of access is the interface, which Unity automatically creates and manages on a GameObject at runtime.
IAdaptivePerformanceFor a code-free approach using visual graphs, refer to the Adaptive Performance package documentation about visual scripting.
Accessing the instance
To access the instance, use .
AdaptivePerformance.Holder.InstanceTo check if your device supports Adaptive Performance, use the property.
IAdaptivePerformance.ActiveDebug logging
To get detailed information during runtime, enable Logging in the provider settings or via during runtime or using boot time flags from :
IDevelopmentSettings.LoggingIAdaptivePerformanceSettingsusing UnityEngine;using UnityEngine.AdaptivePerformance;static class AdaptivePerformanceConfig{ // This method runs automatically after assemblies are loaded, before any scene starts. [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)] static void Setup() { // Retrieve the Adaptive Performance settings. IAdaptivePerformanceSettings settings = AdaptivePerformanceGeneralSettings.Instance.Manager.activeLoader.GetSettings(); // Check if settings were successfully retrieved before modifying. if (settings != null) { // Enable Adaptive Performance logging. settings.logging = true; } }}