Version: Unity 6.4 Alpha (6000.4)
Language : English
Create custom scalers
Apply performance optimizations

Use scaler profiles

Use scaler profiles to quickly move between different performance configurations.

A scaler profile is a saved group of settings for your scalers. Using a profile lets you manage and move between different performance configurations with a single command, instead of changing each setting one-by-one in your code.

For examples of using scaler profiles, refer to the Adaptive Performance samples.

Create scaler profiles

Create and configure scaler profiles in the Adaptive Performance provider settings. Only the Default profile is available by default.

To create a scaler profile:

  1. Open the Adaptive Performance provider settings (menu: Edit > Project Settings > Adaptive Performance).

  2. Select your provider.

  3. In the Scaler Settings section under Scaler Profiles, select the + button to create a new profile. Create a new Scaler Profile in the Adaptive Performance provider settings.

  4. Your new profile appears in the list. Configure the settings as required.

Load scaler profiles at runtime

Important: Loading scaler profiles is resource-intensive. To prevent performance issues, only load profiles when your application’s in a loading state.

To load scaler profiles at runtime:

  1. Query for all profiles created and available during runtime using AdaptivePerformanceGeneralSettings.Instance.
  2. Call LoadScalerProfile and provide the scaler profile name as a string to load.

For example:

using UnityEngine;
using UnityEngine.AdaptivePerformance;
using System.Collections.Generic;

public class ScalerProfileLoader : MonoBehaviour
{
    public void LoadSpecificScalerProfile(int profileIndex)
    {
        // Retrieve the Adaptive Performance settings from the active loader.
        IAdaptivePerformanceSettings settings = AdaptivePerformanceGeneralSettings.Instance.Manager.activeLoader.GetSettings();
        // Check if settings were successfully retrieved.
        if (settings == null)
        {
            return;
        }

        // Get the list of all available scaler profiles.
        List<string> scalerProfiles = settings.GetAvailableScalerProfiles();

        // Check if any scaler profiles are available and the index is valid.
        if (profileIndex >= 0 && profileIndex < scalerProfiles.Count)
        {
            settings.LoadScalerProfile(scalerProfiles[profileIndex]);
        }
    }
}

Additional resources

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