Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unityのメモリリークを調査するための可視化
using UnityEngine;
using System.Collections;
public class DetectLeaks : MonoBehaviour
{
void OnGUI ()
{
GUI.color = Color.black;
GUILayout.BeginArea (new Rect (10, 80, 400, 800));
GUILayout.Label ("All " + FindObjectsOfTypeAll (typeof(UnityEngine.Object)).Length);
GUILayout.Label ("Textures " + FindObjectsOfTypeAll (typeof(Texture)).Length);
GUILayout.Label ("AudioClips " + FindObjectsOfTypeAll (typeof(AudioClip)).Length);
GUILayout.Label ("Meshes " + FindObjectsOfTypeAll (typeof(Mesh)).Length);
GUILayout.Label ("Materials " + FindObjectsOfTypeAll (typeof(Material)).Length);
GUILayout.Label ("GameObjects " + FindObjectsOfTypeAll (typeof(GameObject)).Length);
GUILayout.Label ("Components " + FindObjectsOfTypeAll (typeof(Component)).Length);
GUILayout.EndArea ();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment