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
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961