private void Start() { this._assetList = new AssetList(10); this._assetDetail = E_AssetDetail.Textures; this.DoProfiler(); }
private void OnGUI() { this._pivot.x = Screen.width / 2; this._pivot.y = 0f; GUIUtility.ScaleAroundPivot(this._scale, this._pivot); GUI.backgroundColor = Color.black; float num = ((Screen.width - this._width) / 2) + this._leftOffset; GUILayout.BeginArea(new Rect(Mathf.Clamp(num, 0f, (float)(Screen.width - this._width)), (float)this._top, (float)this._width, (float)this._heigth)); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.BeginVertical(new GUILayoutOption[0]); if (GUILayout.Button("Memory Profiler", new GUILayoutOption[0])) { this.DoDestroy(); } GUI.backgroundColor = Color.green; if (GUILayout.Button(string.Format("Normal Texture: {0} MB", this._memory_texture), new GUILayoutOption[0])) { this._assetDetail = E_AssetDetail.Textures; } if (GUILayout.Button(string.Format("Render Texture: {0} MB", this._memory_renderTexture), new GUILayoutOption[0])) { this._assetDetail = E_AssetDetail.RenderTextures; } if (GUILayout.Button(string.Format("Mesh: {0} MB", this._memory_mesh), new GUILayoutOption[0])) { this._assetDetail = E_AssetDetail.Meshes; } if (GUILayout.Button(string.Format("AnimationClip: {0} MB", this._memory_animationClip), new GUILayoutOption[0])) { this._assetDetail = E_AssetDetail.AnimationClips; } if (GUILayout.Button(string.Format("Material: {0} MB", this._memory_material), new GUILayoutOption[0])) { this._assetDetail = E_AssetDetail.Meterials; } GUI.backgroundColor = Color.yellow; GUILayout.Button(string.Format("Mono Heap: {0} MB", this._memory_monoHeap), new GUILayoutOption[0]); GUILayout.Button(string.Format("Mono Used: {0} MB", this._memory_monoUsed), new GUILayoutOption[0]); GUILayout.Button(string.Format("{0} GameObjects: {1} MB", this._num_gameobject, this._memory_gameobject), new GUILayoutOption[0]); GUI.backgroundColor = Color.black; GUILayout.BeginHorizontal(new GUILayoutOption[0]); if (GUILayout.Button("Left", new GUILayoutOption[0])) { this._leftOffset -= this._moveStep; } if (GUILayout.Button("Right", new GUILayoutOption[0])) { this._leftOffset += this._moveStep; } GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.BeginVertical(new GUILayoutOption[0]); GUI.backgroundColor = Color.gray; if (this._assetDetail != E_AssetDetail.None) { foreach (AssetList.AssetItem item in this._assetList.GetList()) { GUILayout.Button(string.Format("{0} KB {1}", this.ToKiloBytes(item._size), item._name), new GUILayoutOption[0]); } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.EndArea(); }