Class GpuMemoryCensus
What the client holds in GPU memory, as rows in the log: every loaded texture, render target and mesh, sized from its real format, dimensions, mips, slices and samples, then totalled by kind, by format and by name family, with the largest items listed. Logged 15, 45 and 90 s after a world scene loads (the biome art arrives in between). Search the log (the browser console on the web) for "[GPU census]".
public sealed class GpuMemoryCensus : MonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourGpuMemoryCensus
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Remarks
Off unless asked for, because it walks every loaded object: add ?gpumem to the page URL on the web, pass
-gpumem to a player, or set FISHMMO_GPU_CENSUS=1. A release build needs no development flag: the
sizes are computed, not read from the profiler (which reports nothing outside development builds).
What it cannot see: GraphicsBuffers and ComputeBuffers (Unity has no way to list them), the render pipeline's
transient targets, and the browser's own overhead. Compare its total with the GPU process's real use (nvidia-smi);
the gap is those. On the web it also logs the WebGPU device's features: without texture-compression-bc,
Unity expands every DXT/BC texture to RGBA on upload, which the "by format" row then shows.
Properties
Enabled
True when this run asked for the census (URL, command line or environment).
public static bool Enabled { get; }
Property Value
Methods
Report(string)
The census of this moment, as one multi-line log message.
public static string Report(string reason)
Parameters
reasonstring