Version: Unity 6.4 Alpha (6000.4)
Language : English
Set up Adaptive Performance
Providers

Scripting with Adaptive Performance

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 IAdaptivePerformance interface, which Unity automatically creates and manages on a GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
at runtime.

For 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.Instance.

To check if your device supports Adaptive Performance, use the IAdaptivePerformance.Active property.

Debug logging

To get detailed information during runtime, enable Logging in the provider settings or via IDevelopmentSettings.Logging during runtime or using boot time flags from IAdaptivePerformanceSettings:


using 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;
        }
    }
}

Additional resources

Set up Adaptive Performance
Providers