Profiler.GetTotalReservedMemoryLong

切换到手册
public static long GetTotalReservedMemoryLong ();

返回

long Unity 预留的内存(以字节为单位)。如果性能分析器不可用,则返回 0。

描述

Unity 预留的总内存。

此函数返回 Unity 为当前和未来分配预留的内存总量。如果预留内存已用尽,Unity 会根据需要从系统中分配更多内存。

using UnityEngine;
using UnityEngine.Profiling;

public class Example : MonoBehaviour { void Update() { Debug.Log("Total Reserved memory by Unity: " + Profiler.GetTotalReservedMemoryLong() + "Bytes"); Debug.Log("- Allocated memory by Unity: " + Profiler.GetTotalAllocatedMemoryLong() + "Bytes"); Debug.Log("- Reserved but not allocated: " + Profiler.GetTotalUnusedReservedMemoryLong() + "Bytes"); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961