Unity 6.3
0 онлайн 96 гостей 3 в системе
Вход
Оптимизация Шаг 193 из 208

Проверка поддержки функций

Проверьте, поддерживает ли ваше устройство определенную функцию адаптивной производительности.

Адаптивная производительность предоставляется с различными функциями. Вы можете проверить, какие функции поддерживает устройство, используя IAdaptivePerformance.SupportedFeature. Доступные функции поставщика см. в перечислении Feature.

Ниже приводится пример проверки ,Feature.ClusterInfo,:

using UnityEngine;
using UnityEngine.AdaptivePerformance;
using UnityEngine.AdaptivePerformance.Provider;

public class AdaptivePerformanceFeatureChecker : MonoBehaviour
{
    // Declare 'ap' as a private class-level field to hold the IAdaptivePerformance instance.
    private IAdaptivePerformance ap;

    void Start()
    {
        // Get the Adaptive Performance instance.
        ap = Holder.Instance;

        // Check if Adaptive Performance is active.
        if (ap == null || !ap.Active)
        {
            Debug.Log("[AP ClusterInfo] Adaptive Performance not active.");
            return;
        }
        // Check if the ClusterInfo feature is supported by the active provider.
        if (!ap.SupportedFeature(Feature.ClusterInfo))
        {
            Debug.Log("[AP ClusterInfo] Feature not supported.");
        }
        // Access ClusterInfo metrics if the feature is supported.
        var clusterInfo = ap.PerformanceStatus.PerformanceMetrics.ClusterInfo;
    }
}

Дополнительные ресурсы