Version: Unity 6.6 Alpha (6000.6)
LanguageEnglish
  • C#

Holder.Deinitialize

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static void Deinitialize();

Description

Stops Adaptive Performance and cleans up all associated resources and objects.

Use this method to perform a complete shutdown of the Adaptive Performance system. This method first stops any running Adaptive Performance operations by calling IAdaptivePerformance.DeinitializeAdaptivePerformance. It then cleans up the provider infrastructure and sets Holder.Instance to null.

After this method completes successfully, all Adaptive Performance functionality is unavailable until Holder.Initialize is called again.

It's safe to call this method even if Adaptive Performance isn't currently initialized.

 using UnityEngine;
 using UnityEngine.AdaptivePerformance;

public class AdaptivePerformanceManager : MonoBehaviour { void OnApplicationPause(bool pauseStatus) { if (pauseStatus) { // Adaptive Performance state before deinitialization. Debug.Log($"Adaptive Performance initialized: {Holder.Instance.Initialized}");

// Clean up Adaptive Performance when app is paused. Holder.Deinitialize(); Debug.Log("Adaptive Performance deinitialized");

// Adaptive Performance state after deinitialization. Debug.Log($"Adaptive Performance initialized: {Holder.Instance!=null && Holder.Instance.Initialized}"); } } }