private void TakeSamples(Object[] des, System.Type t, DrawDatas dt, GameObject go) { foreach (var g in des) { if (t.IsAssignableFrom(g.GetType())) { SampleObject s; if (!m_objectMap.TryGetValue(g, out s)) { int size = GetObjectSize(g); s = new SampleObject(g); s.gameObjects.Add(go); dt.objects.Add(s); dt.totalSize += size; m_objectMap.Add(g, s); } else { s.gameObjects.Add(go); } } } }
private void DrawTextureSample(System.Type t, DrawDatas dt) { Color c = GUI.color; GUI.color = Color.green; EditorGUILayout.LabelField(string.Format("Total{0}Size:{1}", t.Name, GetShowSize(dt.totalSize))); GUI.color = c; dt.scrollPosition = EditorGUILayout.BeginScrollView(dt.scrollPosition, GUILayout.Height(Mathf.Min(200, 20 * dt.objects.Count))); foreach (var m in dt.objects) { EditorGUILayout.BeginHorizontal(); GUI.color = !m.isInScene ? Color.red : c; EditorGUILayout.LabelField(string.Format("Name:{0} Size:{1}", m.name, GetShowSize(m.size))); GUI.color = c; EditorGUILayout.ObjectField(m.obj, m.obj.GetType(), false); GameObject obj = m.gameObjects.Count > 0 ? m.gameObjects[0] : null; EditorGUILayout.ObjectField(obj, typeof(GameObject), false); EditorGUILayout.LabelField(string.Format("ref count:{0}", m.gameObjects.Count)); EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); GUILayout.Space(5); }