Version: 1.8
LanguageEnglish
  • C#

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

Parameters

sceneSwitchCallbackOnQuit Callback which will be executed when the application was quitting
sceneSwitchCallbackTimeout The timeout wait to load scene.

Description

Subscribe callback for capturing memory snapshots

using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.OpenHarmony;

public class MemorySnapshotExample : MonoBehaviour { private void Start() { OpenHarmonyMemorySnapshot.SubscribeHandler(() => { var asyncOperation = SceneManager.LoadSceneAsync("Login"); asyncOperation.allowSceneActivation = true; asyncOperation.completed += (operation) => { //capture memory snapshot when the scene loading is completed. OpenHarmonyMemorySnapshot.CaptureMemorySnapshot(); }; }, 5000); }

public void QuitApplication() { Application.Quit(); } }