Skip to content

Instantly share code, notes, and snippets.

@hisasann
Created August 29, 2014 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hisasann/b3b09d729e8cae11ce6a to your computer and use it in GitHub Desktop.
Save hisasann/b3b09d729e8cae11ce6a to your computer and use it in GitHub Desktop.
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