├── .gitignore ├── CHANGELOG.md ├── CHANGELOG.md.meta ├── Documentation~ └── images │ ├── brief_overview_01.png │ ├── capture_dropdown_01.png │ ├── compare_snapshot_01.png │ ├── cpp_asset_duplicates_01.png │ ├── cpp_view_01.png │ ├── cs_delegate_targets_01.png │ ├── cs_delegates_01.png │ ├── cs_delegates_02.png │ ├── cs_duplicates_01.png │ ├── cs_empty_shell_objects_01.png │ ├── cs_hexview_01.png │ ├── cs_inspector_01.png │ ├── cs_inspector_02.png │ ├── cs_inspector_03.png │ ├── cs_inspector_04.png │ ├── cs_inspector_05.png │ ├── cs_memory_sections_01.png │ ├── cs_paths_to_root_01.png │ ├── cs_static_fields_01.png │ ├── cs_view_01.png │ └── references_referencedby_01.png ├── Editor.meta ├── Editor ├── Fonts.meta ├── Fonts │ ├── cour.ttf │ └── cour.ttf.meta ├── Icons.meta ├── Icons │ ├── CPlusPlus.png │ ├── CPlusPlus.png.meta │ ├── CSharp.png │ ├── CSharp.png.meta │ ├── CSharpDelegateType.png │ ├── CSharpDelegateType.png.meta │ ├── CSharpEnumType.png │ ├── CSharpEnumType.png.meta │ ├── CSharpReferenceType.png │ ├── CSharpReferenceType.png.meta │ ├── CSharpStatic.png │ ├── CSharpStatic.png.meta │ ├── CSharpValueType.png │ ├── CSharpValueType.png.meta │ ├── GCHandle.png │ ├── GCHandle.png.meta │ ├── GotoCSharp.png │ └── GotoCSharp.png.meta ├── Scripts.meta ├── Scripts │ ├── AbstractTreeView.cs │ ├── AbstractTreeView.cs.meta │ ├── AbstractView.cs │ ├── AbstractView.cs.meta │ ├── CompareSnapshotsView.meta │ ├── CompareSnapshotsView │ │ ├── CompareSnapshotsControl.cs │ │ ├── CompareSnapshotsControl.cs.meta │ │ ├── CompareSnapshotsView.cs │ │ └── CompareSnapshotsView.cs.meta │ ├── ConnectionsView.meta │ ├── ConnectionsView │ │ ├── ConnectionsControl.cs │ │ ├── ConnectionsControl.cs.meta │ │ ├── ConnectionsView.cs │ │ └── ConnectionsView.cs.meta │ ├── CsvExport.meta │ ├── CsvExport │ │ ├── CsvExportView.cs │ │ └── CsvExportView.cs.meta │ ├── DataVisualizer.meta │ ├── DataVisualizer │ │ ├── DataVisualizer.cs │ │ └── DataVisualizer.cs.meta │ ├── GCHandlesView.meta │ ├── GCHandlesView │ │ ├── GCHandlesControl.cs │ │ ├── GCHandlesControl.cs.meta │ │ ├── GCHandlesView.cs │ │ └── GCHandlesView.cs.meta │ ├── HeEditorGUI.cs │ ├── HeEditorGUI.cs.meta │ ├── HeEditorStyles.cs │ ├── HeEditorStyles.cs.meta │ ├── HeEditorUtility.cs │ ├── HeEditorUtility.cs.meta │ ├── HeGlobals.cs │ ├── HeGlobals.cs.meta │ ├── HeMruFiles.cs │ ├── HeMruFiles.cs.meta │ ├── HeapExplorerWindow.cs │ ├── HeapExplorerWindow.cs.meta │ ├── HexViewControl.cs │ ├── HexViewControl.cs.meta │ ├── ManagedEmptyShellObjectsView.meta │ ├── ManagedEmptyShellObjectsView │ │ ├── ManagedEmptyShellObjectsControl.cs │ │ ├── ManagedEmptyShellObjectsControl.cs.meta │ │ ├── ManagedEmptyShellObjectsView.cs │ │ └── ManagedEmptyShellObjectsView.cs.meta │ ├── ManagedHeapSectionsView.meta │ ├── ManagedHeapSectionsView │ │ ├── ManagedHeapSectionsControl.cs │ │ ├── ManagedHeapSectionsControl.cs.meta │ │ ├── ManagedHeapSectionsView.cs │ │ └── ManagedHeapSectionsView.cs.meta │ ├── ManagedObjectDuplicatesView.meta │ ├── ManagedObjectDuplicatesView │ │ ├── ManagedObjectDuplicatesControl.cs │ │ ├── ManagedObjectDuplicatesControl.cs.meta │ │ ├── ManagedObjectDuplicatesView.cs │ │ └── ManagedObjectDuplicatesView.cs.meta │ ├── ManagedObjectsView.meta │ ├── ManagedObjectsView │ │ ├── ManagedObjectsControl.cs │ │ ├── ManagedObjectsControl.cs.meta │ │ ├── ManagedObjectsView.cs │ │ └── ManagedObjectsView.cs.meta │ ├── ManagedTypesView.meta │ ├── ManagedTypesView │ │ ├── ManagedTypesControl.cs │ │ ├── ManagedTypesControl.cs.meta │ │ ├── ManagedTypesView.cs │ │ └── ManagedTypesView.cs.meta │ ├── MemoryReader.cs │ ├── MemoryReader.cs.meta │ ├── MemoryWindow.cs │ ├── MemoryWindow.cs.meta │ ├── NativeObjectsView.meta │ ├── NativeObjectsView │ │ ├── AbstractNativeObjectsView.cs │ │ ├── AbstractNativeObjectsView.cs.meta │ │ ├── NativeObjectControl.cs │ │ ├── NativeObjectControl.cs.meta │ │ ├── NativeObjectDuplicatesView.cs │ │ ├── NativeObjectDuplicatesView.cs.meta │ │ ├── NativeObjectPreviewView.cs │ │ ├── NativeObjectPreviewView.cs.meta │ │ ├── NativeObjectsControl.cs │ │ ├── NativeObjectsControl.cs.meta │ │ ├── NativeObjectsView.cs │ │ └── NativeObjectsView.cs.meta │ ├── OverviewView.meta │ ├── OverviewView │ │ ├── OverviewView.cs │ │ └── OverviewView.cs.meta │ ├── PackedTypes.meta │ ├── PackedTypes │ │ ├── PackedConnection.cs │ │ ├── PackedConnection.cs.meta │ │ ├── PackedCoreTypes.cs │ │ ├── PackedCoreTypes.cs.meta │ │ ├── PackedGCHandle.cs │ │ ├── PackedGCHandle.cs.meta │ │ ├── PackedManagedField.cs │ │ ├── PackedManagedField.cs.meta │ │ ├── PackedManagedObject.cs │ │ ├── PackedManagedObject.cs.meta │ │ ├── PackedManagedObjectCrawler.cs │ │ ├── PackedManagedObjectCrawler.cs.meta │ │ ├── PackedManagedStaticField.cs │ │ ├── PackedManagedStaticField.cs.meta │ │ ├── PackedManagedType.cs │ │ ├── PackedManagedType.cs.meta │ │ ├── PackedMemorySection.cs │ │ ├── PackedMemorySection.cs.meta │ │ ├── PackedMemorySnapshot.cs │ │ ├── PackedMemorySnapshot.cs.meta │ │ ├── PackedMemorySnapshotEx.cs │ │ ├── PackedMemorySnapshotEx.cs.meta │ │ ├── PackedMemorySnapshotHeader.cs │ │ ├── PackedMemorySnapshotHeader.cs.meta │ │ ├── PackedNativeType.cs │ │ ├── PackedNativeType.cs.meta │ │ ├── PackedNativeUnityEngineObject.cs │ │ ├── PackedNativeUnityEngineObject.cs.meta │ │ ├── PackedVirtualMachineInformation.cs │ │ └── PackedVirtualMachineInformation.cs.meta │ ├── PropertyGrid.meta │ ├── PropertyGrid │ │ ├── ArrayElementPropertyGridItem.cs │ │ ├── ArrayElementPropertyGridItem.cs.meta │ │ ├── ArrayPropertyGridItem.cs │ │ ├── ArrayPropertyGridItem.cs.meta │ │ ├── BaseClassPropertyGridItem.cs │ │ ├── BaseClassPropertyGridItem.cs.meta │ │ ├── PrimitiveTypePropertyGridItem.cs │ │ ├── PrimitiveTypePropertyGridItem.cs.meta │ │ ├── PropertyGridControl.cs │ │ ├── PropertyGridControl.cs.meta │ │ ├── PropertyGridItem.cs │ │ ├── PropertyGridItem.cs.meta │ │ ├── PropertyGridView.cs │ │ ├── PropertyGridView.cs.meta │ │ ├── ReferenceTypePropertyGridItem.cs │ │ ├── ReferenceTypePropertyGridItem.cs.meta │ │ ├── ValueTypePropertyGridItem.cs │ │ └── ValueTypePropertyGridItem.cs.meta │ ├── RichTypes.meta │ ├── RichTypes │ │ ├── RichGCHandle.cs │ │ ├── RichGCHandle.cs.meta │ │ ├── RichManagedObject.cs │ │ ├── RichManagedObject.cs.meta │ │ ├── RichManagedType.cs │ │ ├── RichManagedType.cs.meta │ │ ├── RichNativeObject.cs │ │ ├── RichNativeObject.cs.meta │ │ ├── RichNativeType.cs │ │ ├── RichNativeType.cs.meta │ │ ├── RichStaticField.cs │ │ └── RichStaticField.cs.meta │ ├── RootPathView.meta │ ├── RootPathView │ │ ├── RootPathControl.cs │ │ ├── RootPathControl.cs.meta │ │ ├── RootPathView.cs │ │ └── RootPathView.cs.meta │ ├── SearchTextParser.cs │ ├── SearchTextParser.cs.meta │ ├── StaticFieldsView.meta │ ├── StaticFieldsView │ │ ├── StaticFieldsControl.cs │ │ ├── StaticFieldsControl.cs.meta │ │ ├── StaticFieldsView.cs │ │ └── StaticFieldsView.cs.meta │ ├── TestVariables.cs │ ├── TestVariables.cs.meta │ ├── WelcomeView.meta │ └── WelcomeView │ │ ├── WelcomeView.cs │ │ └── WelcomeView.cs.meta ├── Unity.HeapExplorer.Editor.asmdef └── Unity.HeapExplorer.Editor.asmdef.meta ├── LICENSE.md ├── LICENSE.md.meta ├── README.md ├── README.md.meta ├── Tests.meta ├── Tests ├── Editor.meta └── Editor │ ├── Test_Editor.cs │ ├── Test_Editor.cs.meta │ ├── Unity.HeapExplorer.Editor.Tests.asmdef │ └── Unity.HeapExplorer.Editor.Tests.asmdef.meta ├── package.json └── package.json.meta /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | ################################################# 3 | # User related files 4 | ################################################# 5 | TimeTracking-crash.json 6 | Backup/ 7 | 8 | ################################################# 9 | # Project related files 10 | ################################################# 11 | Unity/Assets/Resources/BuildInfo.json 12 | Unity/Assets/StreamingAssets/Commandline.txt 13 | 14 | 15 | ################################################# 16 | # Unity generated files 17 | ################################################# 18 | Unity/Temp/ 19 | Unity/Library/ 20 | Unity/Logs/ 21 | Unity/obj/ 22 | Unity/bin/ 23 | Unity/*.csproj 24 | Unity/*.sln 25 | #Unity/.vs 26 | Unity/Unity.userprefs 27 | 28 | UnityDLL/Temp/* 29 | UnityDLL/Library/* 30 | UnityDLL/*.csproj 31 | UnityDLL/*.sln 32 | #UnityDLL/.vs 33 | UnityDLL/Unity.userprefs 34 | .vs 35 | UnityDLL/Code/bin/* 36 | UnityDLL/Code/obj/* 37 | 38 | *.suo 39 | 40 | ################################################# 41 | # OS generated files 42 | ################################################# 43 | .DS_Store 44 | .DS_Store? 45 | ._* 46 | .Spotlight-V100 47 | .Trashes 48 | ehthumbs.db 49 | Thumbs.db 50 | -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 45f131bdd44885544b39319243f1402e 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Documentation~/images/brief_overview_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/brief_overview_01.png -------------------------------------------------------------------------------- /Documentation~/images/capture_dropdown_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/capture_dropdown_01.png -------------------------------------------------------------------------------- /Documentation~/images/compare_snapshot_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/compare_snapshot_01.png -------------------------------------------------------------------------------- /Documentation~/images/cpp_asset_duplicates_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cpp_asset_duplicates_01.png -------------------------------------------------------------------------------- /Documentation~/images/cpp_view_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cpp_view_01.png -------------------------------------------------------------------------------- /Documentation~/images/cs_delegate_targets_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_delegate_targets_01.png -------------------------------------------------------------------------------- /Documentation~/images/cs_delegates_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_delegates_01.png -------------------------------------------------------------------------------- /Documentation~/images/cs_delegates_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_delegates_02.png -------------------------------------------------------------------------------- /Documentation~/images/cs_duplicates_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_duplicates_01.png -------------------------------------------------------------------------------- /Documentation~/images/cs_empty_shell_objects_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_empty_shell_objects_01.png -------------------------------------------------------------------------------- /Documentation~/images/cs_hexview_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_hexview_01.png -------------------------------------------------------------------------------- /Documentation~/images/cs_inspector_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_inspector_01.png -------------------------------------------------------------------------------- /Documentation~/images/cs_inspector_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_inspector_02.png -------------------------------------------------------------------------------- /Documentation~/images/cs_inspector_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_inspector_03.png -------------------------------------------------------------------------------- /Documentation~/images/cs_inspector_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_inspector_04.png -------------------------------------------------------------------------------- /Documentation~/images/cs_inspector_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_inspector_05.png -------------------------------------------------------------------------------- /Documentation~/images/cs_memory_sections_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_memory_sections_01.png -------------------------------------------------------------------------------- /Documentation~/images/cs_paths_to_root_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_paths_to_root_01.png -------------------------------------------------------------------------------- /Documentation~/images/cs_static_fields_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_static_fields_01.png -------------------------------------------------------------------------------- /Documentation~/images/cs_view_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/cs_view_01.png -------------------------------------------------------------------------------- /Documentation~/images/references_referencedby_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Documentation~/images/references_referencedby_01.png -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dae5013bf9e1cee47863256bf42b994a 3 | folderAsset: yes 4 | timeCreated: 1510593812 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Fonts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f0f7e9284ea40542aaabdc0ce69a323 3 | folderAsset: yes 4 | timeCreated: 1522684646 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Fonts/cour.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Editor/Fonts/cour.ttf -------------------------------------------------------------------------------- /Editor/Fonts/cour.ttf.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f173975cb021a9a418c0814ed4075a24 3 | timeCreated: 1510752209 4 | licenseType: Free 5 | TrueTypeFontImporter: 6 | externalObjects: {} 7 | serializedVersion: 4 8 | fontSize: 12 9 | forceTextureCase: -2 10 | characterSpacing: 0 11 | characterPadding: 1 12 | includeFontData: 1 13 | fontName: Courier New 14 | fontNames: 15 | - Courier New 16 | fallbackFontReferences: [] 17 | customCharacters: 18 | fontRenderingMode: 2 19 | ascentCalculationMode: 1 20 | useLegacyBoundsCalculation: 0 21 | userData: 22 | assetBundleName: 23 | assetBundleVariant: 24 | -------------------------------------------------------------------------------- /Editor/Icons.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15ba9c75d4d6eec468f9ce0f8d61f50a 3 | folderAsset: yes 4 | timeCreated: 1511595013 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Icons/CPlusPlus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Editor/Icons/CPlusPlus.png -------------------------------------------------------------------------------- /Editor/Icons/CPlusPlus.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f4f04936efd4f241820adb1ec65725c 3 | timeCreated: 1511595013 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 1 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 0 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | - buildTarget: Standalone 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 0 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | - buildTarget: Windows Store Apps 80 | maxTextureSize: 2048 81 | resizeAlgorithm: 0 82 | textureFormat: -1 83 | textureCompression: 0 84 | compressionQuality: 50 85 | crunchedCompression: 0 86 | allowsAlphaSplitting: 0 87 | overridden: 0 88 | androidETC2FallbackOverride: 0 89 | spriteSheet: 90 | serializedVersion: 2 91 | sprites: [] 92 | outline: [] 93 | physicsShape: [] 94 | spritePackingTag: 95 | userData: 96 | assetBundleName: 97 | assetBundleVariant: 98 | -------------------------------------------------------------------------------- /Editor/Icons/CSharp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Editor/Icons/CSharp.png -------------------------------------------------------------------------------- /Editor/Icons/CSharp.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4189a6ed6210b5748887671a3778b379 3 | timeCreated: 1511595013 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 1 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 0 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | - buildTarget: Standalone 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 0 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | - buildTarget: Windows Store Apps 80 | maxTextureSize: 2048 81 | resizeAlgorithm: 0 82 | textureFormat: -1 83 | textureCompression: 0 84 | compressionQuality: 50 85 | crunchedCompression: 0 86 | allowsAlphaSplitting: 0 87 | overridden: 0 88 | androidETC2FallbackOverride: 0 89 | spriteSheet: 90 | serializedVersion: 2 91 | sprites: [] 92 | outline: [] 93 | physicsShape: [] 94 | spritePackingTag: 95 | userData: 96 | assetBundleName: 97 | assetBundleVariant: 98 | -------------------------------------------------------------------------------- /Editor/Icons/CSharpDelegateType.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Editor/Icons/CSharpDelegateType.png -------------------------------------------------------------------------------- /Editor/Icons/CSharpDelegateType.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eaab7ccc755b01c40be3d71543df1394 3 | timeCreated: 1519483183 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 1 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 0 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | - buildTarget: Standalone 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 0 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | - buildTarget: Android 80 | maxTextureSize: 2048 81 | resizeAlgorithm: 0 82 | textureFormat: -1 83 | textureCompression: 0 84 | compressionQuality: 50 85 | crunchedCompression: 0 86 | allowsAlphaSplitting: 0 87 | overridden: 0 88 | androidETC2FallbackOverride: 0 89 | spriteSheet: 90 | serializedVersion: 2 91 | sprites: [] 92 | outline: [] 93 | physicsShape: [] 94 | spritePackingTag: 95 | userData: 96 | assetBundleName: 97 | assetBundleVariant: 98 | -------------------------------------------------------------------------------- /Editor/Icons/CSharpEnumType.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Editor/Icons/CSharpEnumType.png -------------------------------------------------------------------------------- /Editor/Icons/CSharpEnumType.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2aa66c73037d20f4ca0ca7ea063ed5ef 3 | timeCreated: 1515059224 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 1 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 0 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | - buildTarget: Standalone 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 0 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | - buildTarget: Windows Store Apps 80 | maxTextureSize: 2048 81 | resizeAlgorithm: 0 82 | textureFormat: -1 83 | textureCompression: 0 84 | compressionQuality: 50 85 | crunchedCompression: 0 86 | allowsAlphaSplitting: 0 87 | overridden: 0 88 | androidETC2FallbackOverride: 0 89 | spriteSheet: 90 | serializedVersion: 2 91 | sprites: [] 92 | outline: [] 93 | physicsShape: [] 94 | spritePackingTag: 95 | userData: 96 | assetBundleName: 97 | assetBundleVariant: 98 | -------------------------------------------------------------------------------- /Editor/Icons/CSharpReferenceType.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Editor/Icons/CSharpReferenceType.png -------------------------------------------------------------------------------- /Editor/Icons/CSharpReferenceType.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d3a16fb87d92f947b45e325db6a5d5b 3 | timeCreated: 1515058177 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 1 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 0 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | - buildTarget: Standalone 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 0 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | - buildTarget: Windows Store Apps 80 | maxTextureSize: 2048 81 | resizeAlgorithm: 0 82 | textureFormat: -1 83 | textureCompression: 0 84 | compressionQuality: 50 85 | crunchedCompression: 0 86 | allowsAlphaSplitting: 0 87 | overridden: 0 88 | androidETC2FallbackOverride: 0 89 | spriteSheet: 90 | serializedVersion: 2 91 | sprites: [] 92 | outline: [] 93 | physicsShape: [] 94 | spritePackingTag: 95 | userData: 96 | assetBundleName: 97 | assetBundleVariant: 98 | -------------------------------------------------------------------------------- /Editor/Icons/CSharpStatic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Editor/Icons/CSharpStatic.png -------------------------------------------------------------------------------- /Editor/Icons/CSharpStatic.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2c7f0914a62e8a4a8c27dbe3db17fe8 3 | timeCreated: 1513001157 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 1 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 0 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | - buildTarget: Standalone 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 0 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | - buildTarget: Windows Store Apps 80 | maxTextureSize: 2048 81 | resizeAlgorithm: 0 82 | textureFormat: -1 83 | textureCompression: 0 84 | compressionQuality: 50 85 | crunchedCompression: 0 86 | allowsAlphaSplitting: 0 87 | overridden: 0 88 | androidETC2FallbackOverride: 0 89 | spriteSheet: 90 | serializedVersion: 2 91 | sprites: [] 92 | outline: [] 93 | physicsShape: [] 94 | spritePackingTag: 95 | userData: 96 | assetBundleName: 97 | assetBundleVariant: 98 | -------------------------------------------------------------------------------- /Editor/Icons/CSharpValueType.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Editor/Icons/CSharpValueType.png -------------------------------------------------------------------------------- /Editor/Icons/CSharpValueType.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8779aacd3627a594ca3539351856b14b 3 | timeCreated: 1515057815 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 1 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 0 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | - buildTarget: Standalone 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 0 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | - buildTarget: Windows Store Apps 80 | maxTextureSize: 2048 81 | resizeAlgorithm: 0 82 | textureFormat: -1 83 | textureCompression: 0 84 | compressionQuality: 50 85 | crunchedCompression: 0 86 | allowsAlphaSplitting: 0 87 | overridden: 0 88 | androidETC2FallbackOverride: 0 89 | spriteSheet: 90 | serializedVersion: 2 91 | sprites: [] 92 | outline: [] 93 | physicsShape: [] 94 | spritePackingTag: 95 | userData: 96 | assetBundleName: 97 | assetBundleVariant: 98 | -------------------------------------------------------------------------------- /Editor/Icons/GCHandle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Editor/Icons/GCHandle.png -------------------------------------------------------------------------------- /Editor/Icons/GCHandle.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 36d1676fb78c3944a91ce0426cc01fdf 3 | timeCreated: 1511595013 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 1 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 0 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | - buildTarget: Standalone 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 0 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | - buildTarget: Windows Store Apps 80 | maxTextureSize: 2048 81 | resizeAlgorithm: 0 82 | textureFormat: -1 83 | textureCompression: 0 84 | compressionQuality: 50 85 | crunchedCompression: 0 86 | allowsAlphaSplitting: 0 87 | overridden: 0 88 | androidETC2FallbackOverride: 0 89 | spriteSheet: 90 | serializedVersion: 2 91 | sprites: [] 92 | outline: [] 93 | physicsShape: [] 94 | spritePackingTag: 95 | userData: 96 | assetBundleName: 97 | assetBundleVariant: 98 | -------------------------------------------------------------------------------- /Editor/Icons/GotoCSharp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Editor/Icons/GotoCSharp.png -------------------------------------------------------------------------------- /Editor/Icons/GotoCSharp.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c1a77ba9271734c40830f5a0abc3488f 3 | timeCreated: 1511597956 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | externalObjects: {} 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 0 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapsPreserveCoverage: 0 17 | alphaTestReferenceValue: 0.5 18 | mipMapFadeDistanceStart: 1 19 | mipMapFadeDistanceEnd: 3 20 | bumpmap: 21 | convertToNormalMap: 0 22 | externalNormalMap: 0 23 | heightScale: 0.25 24 | normalMapFilter: 0 25 | isReadable: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: -1 36 | mipBias: -1 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 49 | spritePixelsToUnits: 100 50 | alphaUsage: 1 51 | alphaIsTransparency: 1 52 | spriteTessellationDetail: -1 53 | textureType: 0 54 | textureShape: 1 55 | maxTextureSizeSet: 0 56 | compressionQualitySet: 0 57 | textureFormatSet: 0 58 | platformSettings: 59 | - buildTarget: DefaultTexturePlatform 60 | maxTextureSize: 2048 61 | resizeAlgorithm: 0 62 | textureFormat: -1 63 | textureCompression: 0 64 | compressionQuality: 50 65 | crunchedCompression: 0 66 | allowsAlphaSplitting: 0 67 | overridden: 0 68 | androidETC2FallbackOverride: 0 69 | - buildTarget: Standalone 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 0 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | - buildTarget: Windows Store Apps 80 | maxTextureSize: 2048 81 | resizeAlgorithm: 0 82 | textureFormat: -1 83 | textureCompression: 0 84 | compressionQuality: 50 85 | crunchedCompression: 0 86 | allowsAlphaSplitting: 0 87 | overridden: 0 88 | androidETC2FallbackOverride: 0 89 | spriteSheet: 90 | serializedVersion: 2 91 | sprites: [] 92 | outline: [] 93 | physicsShape: [] 94 | spritePackingTag: 95 | userData: 96 | assetBundleName: 97 | assetBundleVariant: 98 | -------------------------------------------------------------------------------- /Editor/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9fd75a6a7bf7704c8ee33438d2bf6b2 3 | folderAsset: yes 4 | timeCreated: 1527319053 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/AbstractTreeView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e77f28cc0c96f94696052a2a535028e 3 | timeCreated: 1527319063 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/AbstractView.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | using System; 10 | using System.Linq.Expressions; 11 | 12 | namespace HeapExplorer 13 | { 14 | abstract public class HeapExplorerView 15 | { 16 | /// 17 | /// The titleContent is shown in Heap Explorer's toolbar View menu. 18 | /// 19 | public GUIContent titleContent 20 | { 21 | get; 22 | set; 23 | } 24 | 25 | /// 26 | /// Lets you control the menu item order in Heap Explorer's View menu. 27 | /// Specify a negative value to not create an item in the View menu. 28 | /// If two items are 100 units apart, Heap Explorer inserts a seperator item. 29 | /// 30 | public int viewMenuOrder 31 | { 32 | get; 33 | set; 34 | } 35 | 36 | /// 37 | /// The window in which the view is rendered to. 38 | /// 39 | public HeapExplorerWindow window 40 | { 41 | get; 42 | internal set; 43 | } 44 | 45 | /// 46 | /// Gets whether the view is currently active. 47 | /// 48 | public bool isVisible 49 | { 50 | get; 51 | private set; 52 | } 53 | 54 | /// 55 | /// Gets the active memory snapshot. 56 | /// 57 | public PackedMemorySnapshot snapshot 58 | { 59 | get; 60 | private set; 61 | } 62 | 63 | /// 64 | /// The key-prefix to load and save EditorPrefs. 65 | /// 66 | public string editorPrefsKey 67 | { 68 | get; 69 | set; 70 | } 71 | 72 | List m_Views = new List(); 73 | 74 | // This allows to pass a member variable whose name is converted to a string. 75 | protected string GetPrefsKey(Expression> exp) 76 | { 77 | var body = exp.Body as MemberExpression; 78 | if (body == null) 79 | { 80 | var ubody = (UnaryExpression)exp.Body; 81 | body = ubody.Operand as MemberExpression; 82 | } 83 | 84 | return string.Format("HeapExplorer.{0}.{1}", editorPrefsKey, body.Member.Name); 85 | } 86 | 87 | public HeapExplorerView() 88 | { 89 | editorPrefsKey = GetType().Name; 90 | viewMenuOrder = int.MaxValue - 1; 91 | } 92 | 93 | public virtual void Awake() 94 | { 95 | titleContent = new GUIContent(ObjectNames.NicifyVariableName(GetType().Name)); 96 | } 97 | 98 | public virtual void OnDestroy() 99 | { 100 | foreach (var v in m_Views) 101 | v.OnDestroy(); 102 | 103 | m_Views = null; 104 | snapshot = null; 105 | } 106 | 107 | internal void EvictHeap() 108 | { 109 | snapshot = null; 110 | } 111 | 112 | public void Show(PackedMemorySnapshot heap) 113 | { 114 | if (snapshot != heap) 115 | { 116 | if (snapshot != null && isVisible) 117 | Hide(); // Hide normally implements to save the layout of various UI elements 118 | 119 | snapshot = heap; 120 | OnCreate(); 121 | } 122 | 123 | OnShow(); 124 | 125 | // Show any views that might have been added during OnShow() 126 | foreach (var v in m_Views) 127 | v.Show(heap); 128 | 129 | isVisible = true; 130 | Repaint(); 131 | } 132 | 133 | public void Hide() 134 | { 135 | OnHide(); 136 | 137 | foreach (var v in m_Views) 138 | v.Hide(); 139 | 140 | isVisible = false; 141 | Repaint(); 142 | } 143 | 144 | public virtual int CanProcessCommand(GotoCommand command) 145 | { 146 | return 0; 147 | } 148 | 149 | public virtual void RestoreCommand(GotoCommand command) 150 | { 151 | } 152 | 153 | public virtual GotoCommand GetRestoreCommand() 154 | { 155 | return new GotoCommand(); 156 | } 157 | 158 | /// 159 | /// Implement your own editor GUI here. 160 | /// 161 | public virtual void OnGUI() 162 | { 163 | } 164 | 165 | /// 166 | /// Implement the OnToolbarGUI method to draw your own GUI in Heap Explorer's toolbar menu. 167 | /// 168 | public virtual void OnToolbarGUI() 169 | { 170 | } 171 | 172 | protected virtual void OnCreate() 173 | { 174 | } 175 | 176 | protected virtual void OnShow() 177 | { 178 | } 179 | 180 | protected virtual void OnHide() 181 | { 182 | } 183 | 184 | protected void Goto(GotoCommand command) 185 | { 186 | window.OnGoto(command); 187 | } 188 | 189 | protected void Repaint() 190 | { 191 | window.Repaint(); 192 | } 193 | 194 | protected void ScheduleJob(AbstractThreadJob job) 195 | { 196 | window.ScheduleJob(job); 197 | } 198 | 199 | protected T CreateView() where T : HeapExplorerView, new() 200 | { 201 | var view = new T(); 202 | view.window = window; 203 | view.Awake(); 204 | m_Views.Add(view); 205 | return view; 206 | } 207 | } 208 | } 209 | -------------------------------------------------------------------------------- /Editor/Scripts/AbstractView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e5ae247c7bd9f04399962a05b3003df 3 | timeCreated: 1527319063 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/CompareSnapshotsView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: decb89dbec7c00d4f9fa4cf6298ef753 3 | folderAsset: yes 4 | timeCreated: 1527319053 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/CompareSnapshotsView/CompareSnapshotsControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88b26e4609e1acb47a16e14c69e532f4 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/CompareSnapshotsView/CompareSnapshotsView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4936155a9cbe3574c93cc765a03c0b18 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/ConnectionsView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 546275da307e74243901c224102be3db 3 | folderAsset: yes 4 | timeCreated: 1527319053 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/ConnectionsView/ConnectionsControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 795a2a5c8cbcdef48bc94d5d66a96c05 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/ConnectionsView/ConnectionsView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b1d64bfe8dc69a47992cb6290570b58 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/CsvExport.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f12a4a8ce863d648835b2d07e0d7c25 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Scripts/CsvExport/CsvExportView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f6ed41a885ab9c24aa6e1f42df5d1e90 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Scripts/DataVisualizer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8634573e2a8ac847bcfbb013000813f 3 | folderAsset: yes 4 | timeCreated: 1527319053 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/DataVisualizer/DataVisualizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ebfac61457d05747b3eb868271622f9 3 | timeCreated: 1527319063 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/GCHandlesView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa8dee3c040a1e249b0731542ddd25c9 3 | folderAsset: yes 4 | timeCreated: 1527319054 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/GCHandlesView/GCHandlesControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b80c63a851e4fe44eb3333c078247103 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/GCHandlesView/GCHandlesView.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | using UnityEditor.IMGUI.Controls; 10 | 11 | namespace HeapExplorer 12 | { 13 | public class GCHandlesView : HeapExplorerView 14 | { 15 | GCHandlesControl m_HandlesControl; 16 | HeSearchField m_HandlesSearchField; 17 | ConnectionsView m_ConnectionsView; 18 | PackedGCHandle? m_Selected; 19 | RootPathView m_RootPathView; 20 | float m_SplitterHorz = 0.33333f; 21 | float m_SplitterVert = 0.32f; 22 | 23 | [InitializeOnLoadMethod] 24 | static void Register() 25 | { 26 | HeapExplorerWindow.Register(); 27 | } 28 | 29 | public override void Awake() 30 | { 31 | base.Awake(); 32 | 33 | titleContent = new GUIContent("GC Handles", ""); 34 | viewMenuOrder = 750; 35 | } 36 | 37 | protected override void OnCreate() 38 | { 39 | base.OnCreate(); 40 | 41 | m_ConnectionsView = CreateView(); 42 | m_ConnectionsView.editorPrefsKey = GetPrefsKey(() => m_ConnectionsView); 43 | 44 | m_RootPathView = CreateView(); 45 | m_RootPathView.editorPrefsKey = GetPrefsKey(() => m_RootPathView); 46 | 47 | m_HandlesControl = new GCHandlesControl(window, GetPrefsKey(() => m_HandlesControl), new TreeViewState()); 48 | m_HandlesControl.SetTree(m_HandlesControl.BuildTree(snapshot)); 49 | m_HandlesControl.onSelectionChange += OnListViewSelectionChange; 50 | 51 | m_HandlesSearchField = new HeSearchField(window); 52 | m_HandlesSearchField.downOrUpArrowKeyPressed += m_HandlesControl.SetFocusAndEnsureSelectedItem; 53 | m_HandlesControl.findPressed += m_HandlesSearchField.SetFocus; 54 | 55 | m_SplitterHorz = EditorPrefs.GetFloat(GetPrefsKey(() => m_SplitterHorz), m_SplitterHorz); 56 | m_SplitterVert = EditorPrefs.GetFloat(GetPrefsKey(() => m_SplitterVert), m_SplitterVert); 57 | } 58 | 59 | protected override void OnHide() 60 | { 61 | base.OnHide(); 62 | 63 | m_HandlesControl.SaveLayout(); 64 | 65 | EditorPrefs.SetFloat(GetPrefsKey(() => m_SplitterHorz), m_SplitterHorz); 66 | EditorPrefs.SetFloat(GetPrefsKey(() => m_SplitterVert), m_SplitterVert); 67 | } 68 | 69 | public override void RestoreCommand(GotoCommand command) 70 | { 71 | m_HandlesControl.Select(command.toGCHandle.packed); 72 | } 73 | 74 | public override int CanProcessCommand(GotoCommand command) 75 | { 76 | if (command.toGCHandle.isValid) 77 | return 10; 78 | 79 | return base.CanProcessCommand(command); 80 | } 81 | 82 | public override GotoCommand GetRestoreCommand() 83 | { 84 | if (m_Selected.HasValue) 85 | return new GotoCommand(new RichGCHandle(snapshot, m_Selected.Value.gcHandlesArrayIndex)); 86 | 87 | return base.GetRestoreCommand(); 88 | } 89 | 90 | // Called if the selection changed in the list that contains the managed objects overview. 91 | void OnListViewSelectionChange(PackedGCHandle? packedGCHandle) 92 | { 93 | m_Selected = packedGCHandle; 94 | 95 | if (!packedGCHandle.HasValue) 96 | { 97 | m_RootPathView.Clear(); 98 | m_ConnectionsView.Clear(); 99 | return; 100 | } 101 | 102 | m_ConnectionsView.Inspect(packedGCHandle.Value); 103 | m_RootPathView.Inspect(m_Selected.Value); 104 | } 105 | 106 | public override void OnGUI() 107 | { 108 | base.OnGUI(); 109 | 110 | using (new EditorGUILayout.HorizontalScope()) 111 | { 112 | using (new EditorGUILayout.VerticalScope()) 113 | { 114 | using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel)) 115 | { 116 | using (new EditorGUILayout.HorizontalScope()) 117 | { 118 | EditorGUILayout.LabelField(string.Format("{0} GCHandle(s)", snapshot.gcHandles.Length), EditorStyles.boldLabel); 119 | 120 | if (m_HandlesSearchField.OnToolbarGUI()) 121 | m_HandlesControl.Search(m_HandlesSearchField.text); 122 | } 123 | GUILayout.Space(2); 124 | 125 | m_HandlesControl.OnGUI(); 126 | } 127 | 128 | m_SplitterVert = HeEditorGUILayout.VerticalSplitter("m_splitterVert".GetHashCode(), m_SplitterVert, 0.1f, 0.8f, window); 129 | 130 | using (new EditorGUILayout.HorizontalScope(GUILayout.Height(window.position.height * m_SplitterVert))) 131 | { 132 | m_ConnectionsView.OnGUI(); 133 | } 134 | } 135 | 136 | m_SplitterHorz = HeEditorGUILayout.HorizontalSplitter("m_splitterHorz".GetHashCode(), m_SplitterHorz, 0.1f, 0.8f, window); 137 | 138 | using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel, GUILayout.Width(window.position.width * m_SplitterHorz))) 139 | { 140 | m_RootPathView.OnGUI(); 141 | } 142 | } 143 | } 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /Editor/Scripts/GCHandlesView/GCHandlesView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2fc7bcac31d8e1f4190955f247c191b9 3 | timeCreated: 1527319063 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/HeEditorGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a3bcafb0f7a8b2e4a8a6c6377ace72aa 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/HeEditorStyles.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3fa26b51dac64304a852851e8ebd5c72 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/HeEditorUtility.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor.IMGUI.Controls; 9 | using UnityEditor; 10 | using System.Reflection; 11 | 12 | namespace HeapExplorer 13 | { 14 | public static class HeEditorUtility 15 | { 16 | static int s_Major; 17 | static int s_Minor; 18 | 19 | static HeEditorUtility() 20 | { 21 | var error = false; 22 | var version = Application.unityVersion; 23 | 24 | var splits = version.Split(new[] { '.' }); 25 | if (splits.Length >= 2) 26 | { 27 | if (!int.TryParse(splits[0], out s_Major)) 28 | error = true; 29 | 30 | if (!int.TryParse(splits[1], out s_Minor)) 31 | error = true; 32 | } 33 | else 34 | { 35 | error = true; 36 | } 37 | 38 | if (error) 39 | Debug.LogErrorFormat("HeapExplorer was unable to parse the editor version '{0}'. Could you please post this message in the Heap Explorer forum thread, so I can look at the issue: {1}", version, "https://forum.unity.com/threads/wip-heap-explorer-memory-profiler-debugger-and-analyzer-for-unity.527949/"); 40 | } 41 | 42 | /// 43 | /// Gets whether the Unity editor is the specified version or newer. 44 | /// 45 | public static bool IsVersionOrNewer(int major, int minor) 46 | { 47 | if (s_Major > major) return true; 48 | if (s_Major == major && s_Minor >= minor) return true; 49 | return false; 50 | } 51 | 52 | /// 53 | /// Opens the Unity Profiler window. 54 | /// 55 | public static void OpenProfiler() 56 | { 57 | if (IsVersionOrNewer(2018, 3)) 58 | EditorApplication.ExecuteMenuItem("Window/Analysis/Profiler"); 59 | else if (IsVersionOrNewer(2018, 2)) 60 | EditorApplication.ExecuteMenuItem("Window/Debug/Profiler"); 61 | else 62 | EditorApplication.ExecuteMenuItem("Window/Profiler"); 63 | } 64 | 65 | /// 66 | /// Search the project window using the specified filter. 67 | /// 68 | public static void SearchProjectBrowser(string filter) 69 | { 70 | foreach (var type in typeof(EditorWindow).Assembly.GetTypes()) 71 | { 72 | if (type.Name != "ProjectBrowser") 73 | continue; 74 | 75 | var window = EditorWindow.GetWindow(type); 76 | if (window != null) 77 | { 78 | var method = type.GetMethod("SetSearch", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { typeof(string) }, null); 79 | if (method != null) 80 | method.Invoke(window, new System.Object[] { filter }); 81 | } 82 | 83 | return; 84 | } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Editor/Scripts/HeEditorUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a97b56352491a64988a262821c7a6df 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Scripts/HeGlobals.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2024 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | 9 | namespace HeapExplorer 10 | { 11 | public static class HeGlobals 12 | { 13 | public const string k_Title = "Heap Explorer"; 14 | public const string k_Version = "4.3"; 15 | public const string k_DocuUrl = "https://github.com/pschraut/UnityHeapExplorer"; 16 | public const string k_ChangelogUrl = "https://github.com/pschraut/UnityHeapExplorer/blob/master/CHANGELOG.md"; 17 | public const string k_ForumUrl = "https://forum.unity.com/threads/wip-heap-explorer-memory-profiler-debugger-and-analyzer-for-unity.527949/"; 18 | public const string k_RepositoryUrl = "https://github.com/pschraut/UnityHeapExplorer/"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Editor/Scripts/HeGlobals.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3c437c149008803438fa911bf12f198b 3 | timeCreated: 1527319063 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/HeMruFiles.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | 10 | namespace HeapExplorer 11 | { 12 | public static class HeMruFiles 13 | { 14 | [System.Serializable] 15 | class MruJson 16 | { 17 | public List Paths = new List(); 18 | } 19 | 20 | const int k_MaxPathCount = 15; 21 | const string k_EditorPrefsKey = "HeapExplorer.MostRecentlyUsed"; 22 | static MruJson s_List = new MruJson(); 23 | 24 | public static int count 25 | { 26 | get 27 | { 28 | return s_List.Paths.Count; 29 | } 30 | } 31 | 32 | public static void AddPath(string path) 33 | { 34 | if (s_List.Paths.Count > 0) 35 | { 36 | s_List.Paths.Remove(path); 37 | s_List.Paths.Insert(0, path); 38 | } 39 | else 40 | { 41 | s_List.Paths.Add(path); 42 | } 43 | 44 | if (s_List.Paths.Count > k_MaxPathCount) 45 | { 46 | s_List.Paths.RemoveAt(s_List.Paths.Count - 1); 47 | } 48 | 49 | Save(); 50 | } 51 | 52 | public static string GetPath(int index) 53 | { 54 | return s_List.Paths[index]; 55 | } 56 | 57 | public static void RemovePath(string path) 58 | { 59 | s_List.Paths.Remove(path); 60 | Save(); 61 | } 62 | 63 | public static void RemoveAll() 64 | { 65 | s_List.Paths.Clear(); 66 | Save(); 67 | } 68 | 69 | public static void Load() 70 | { 71 | var json = EditorPrefs.GetString(k_EditorPrefsKey, ""); 72 | try 73 | { 74 | s_List = JsonUtility.FromJson(json); 75 | } 76 | catch { } 77 | 78 | if (s_List == null) 79 | s_List = new MruJson(); 80 | 81 | // Remove entries where the corresponding file does not exist. 82 | for (var n=s_List.Paths.Count-1; n>=0; --n) 83 | { 84 | var path = s_List.Paths[n]; 85 | if (!System.IO.File.Exists(path)) 86 | s_List.Paths.RemoveAt(n); 87 | } 88 | } 89 | 90 | static void Save() 91 | { 92 | try 93 | { 94 | var json = JsonUtility.ToJson(s_List); 95 | EditorPrefs.SetString(k_EditorPrefsKey, json); 96 | } 97 | catch { } 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /Editor/Scripts/HeMruFiles.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f4f811b4faeef64092ff17c48e5221e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Scripts/HeapExplorerWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ac0e137559674e54a82c8ce38f2ce85b 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/HexViewControl.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor.IMGUI.Controls; 9 | using UnityEditor; 10 | 11 | namespace HeapExplorer 12 | { 13 | public struct ArraySegment64 14 | { 15 | public ArraySegment64(T[] array, ulong offset, ulong count) 16 | : this() 17 | { 18 | this.array = array; 19 | this.offset = offset; 20 | this.count = count; 21 | } 22 | 23 | public T[] array { get; private set; } 24 | public ulong offset { get; private set; } 25 | public ulong count { get; private set; } 26 | } 27 | 28 | public class HexViewControl 29 | { 30 | const int k_ColumnCount = 16; 31 | float m_ScrollPosition; 32 | long m_LineCount; 33 | System.Text.StringBuilder m_StringBuilder = new System.Text.StringBuilder(16 * 2 * 128); 34 | System.UInt64 m_StartAddress; 35 | ArraySegment64 m_Heap; 36 | string m_Text; 37 | EditorWindow m_Owner; 38 | int m_VisibleLines; 39 | 40 | public void Create(EditorWindow owner, System.UInt64 startAddress, ArraySegment64 heap) 41 | { 42 | m_Owner = owner; 43 | m_Heap = heap; 44 | m_StartAddress = startAddress; 45 | m_LineCount = (long)((heap.count + k_ColumnCount - 1) / k_ColumnCount); 46 | m_ScrollPosition = 0; 47 | m_VisibleLines = 100; 48 | BuildText(); 49 | 50 | m_Owner.Repaint(); 51 | } 52 | 53 | public void OnGUI() 54 | { 55 | var rect = GUILayoutUtility.GetRect(50, 100000, 50, 100000); 56 | var current = Event.current; 57 | var isScrollWheel = current.isScrollWheel; 58 | if (isScrollWheel && rect.Contains(current.mousePosition)) 59 | { 60 | m_ScrollPosition += Mathf.Sign(current.delta.y); 61 | current.Use(); 62 | } 63 | 64 | var scrollBar = rect; 65 | scrollBar.x += scrollBar.width - 16; 66 | scrollBar.width = 16; 67 | rect.width -= scrollBar.width; 68 | rect.width -= 4; 69 | 70 | var headerRect = rect; 71 | headerRect.height = 25; 72 | //GUI.DrawTexture(headerRect, TreeView.DefaultStyles.backgroundOdd.normal.background); 73 | headerRect.y += 10; 74 | GUI.Label(headerRect, "Address 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F", HeEditorStyles.monoSpaceLabel); 75 | 76 | rect.y += headerRect.height + 2; 77 | rect.height -= headerRect.height + 2; 78 | //GUI.DrawTexture(rect, TreeView.DefaultStyles.backgroundEven.normal.background); 79 | 80 | headerRect.y += 15; 81 | headerRect.height = 1; 82 | var c = GUI.color; 83 | GUI.color = new Color(0, 0, 0, 0.35f); 84 | GUI.DrawTexture(headerRect, EditorGUIUtility.whiteTexture); 85 | GUI.color = c; 86 | 87 | m_VisibleLines = (int)(rect.height / EditorStyles.label.CalcHeight(new GUIContent("01"), 20)); 88 | if (m_VisibleLines > m_LineCount) 89 | m_VisibleLines = (int)m_LineCount; 90 | 91 | var newTopLine = Mathf.Max(0, GUI.VerticalScrollbar(scrollBar, m_ScrollPosition, m_VisibleLines, 0, m_LineCount)); 92 | if (newTopLine != m_ScrollPosition || isScrollWheel) 93 | { 94 | m_ScrollPosition = newTopLine; 95 | BuildText(); 96 | m_Owner.Repaint(); 97 | } 98 | 99 | EditorGUIUtility.GetControlID(FocusType.Passive, rect); 100 | GUI.Label(rect, m_Text, HeEditorStyles.monoSpaceLabel); 101 | } 102 | 103 | void BuildText() 104 | { 105 | m_StringBuilder.Length = 0; 106 | 107 | var lineCount = m_VisibleLines + 8; 108 | for (var y = 0; y < lineCount; ++y) 109 | { 110 | var line = (int)m_ScrollPosition + y; 111 | if (line >= m_LineCount) 112 | break; 113 | 114 | var lineIndex = (uint)line * k_ColumnCount; 115 | var lineAddr = m_StartAddress + lineIndex; 116 | 117 | m_StringBuilder.AppendFormat("{0:X16} ", lineAddr); 118 | 119 | for (var x = 0u; x < k_ColumnCount; ++x) 120 | { 121 | if (lineIndex + x < m_Heap.count) 122 | { 123 | var value = m_Heap.array[m_Heap.offset + lineIndex + x]; 124 | m_StringBuilder.AppendFormat("{0:X2} ", value); 125 | } 126 | else 127 | { 128 | m_StringBuilder.AppendFormat(" "); 129 | } 130 | } 131 | 132 | m_StringBuilder.AppendFormat(" "); 133 | 134 | for (var x = 0u; x < k_ColumnCount && lineIndex + x < m_Heap.count; ++x) 135 | { 136 | if (lineIndex + x < m_Heap.count) 137 | { 138 | var value = m_Heap.array[m_Heap.offset + lineIndex + x]; 139 | if (value < 32) 140 | value = (byte)'.'; 141 | 142 | m_StringBuilder.AppendFormat("{0}", (char)value); 143 | } 144 | else 145 | { 146 | m_StringBuilder.AppendFormat(" "); 147 | } 148 | } 149 | 150 | m_StringBuilder.Append("\n"); 151 | } 152 | m_StringBuilder.Append("\0"); 153 | m_Text = m_StringBuilder.ToString(); 154 | } 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /Editor/Scripts/HexViewControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e3300c840857344c964fb5d26cd7931 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedEmptyShellObjectsView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2bc4995a9598aa47ae94b925cf385b8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedEmptyShellObjectsView/ManagedEmptyShellObjectsControl.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using Unity.Collections.LowLevel.Unsafe; 8 | using UnityEditor.IMGUI.Controls; 9 | using UnityEngine; 10 | 11 | namespace HeapExplorer 12 | { 13 | public class ManagedEmptyShellObjectsControl : AbstractManagedObjectsControl 14 | { 15 | public Progress progress = new Progress(); 16 | 17 | public ManagedEmptyShellObjectsControl(HeapExplorerWindow window, string editorPrefsKey, TreeViewState state) 18 | : base(window, editorPrefsKey, state) 19 | { 20 | } 21 | 22 | protected override void OnBuildTree(TreeViewItem root) 23 | { 24 | progress.value = 0; 25 | 26 | var lookup = new Dictionary(); 27 | var memoryReader = new MemoryReader(m_Snapshot); 28 | 29 | for (int n = 0, nend = m_Snapshot.managedObjects.Length; n < nend; ++n) 30 | { 31 | progress.value = (n + 1.0f) / nend; 32 | 33 | var obj = m_Snapshot.managedObjects[n]; 34 | if (obj.address == 0) 35 | continue; // points to null 36 | 37 | if (obj.nativeObjectsArrayIndex != -1) 38 | continue; // has a native object, thus can't be an empty shell object 39 | 40 | var type = m_Snapshot.managedTypes[obj.managedTypesArrayIndex]; 41 | 42 | // Only UnityEngine.Object objects can have a m_CachedPtr connection to a native object. 43 | if (!type.isUnityEngineObject) 44 | continue; 45 | 46 | // Could be an array of an UnityEngine.Object, such as Texture[] 47 | if (type.isArray) 48 | continue; 49 | 50 | // Get type as a "higher level" representation that is easier to work with 51 | var richType = new RichManagedType(m_Snapshot, obj.managedTypesArrayIndex); 52 | 53 | // Try to get the m_InstanceID field (only exists in editor, not in built players) 54 | PackedManagedField packedField; 55 | if (richType.FindField("m_InstanceID", out packedField)) 56 | { 57 | // The editor contains various empty shell objects whose instanceID all contain 0. 58 | // I guess it's some kind of special object? In this case we just ignore them. 59 | var instanceID = memoryReader.ReadInt32(obj.address + (ulong)packedField.offset); 60 | if (instanceID == 0) 61 | continue; 62 | } 63 | 64 | // Check if we already have a grouping node for that type. 65 | // Create a new node if we don't have it. 66 | AbstractItem parent; 67 | if (!lookup.TryGetValue(type.name, out parent)) 68 | { 69 | var group = new GroupItem() 70 | { 71 | id = m_UniqueId++, 72 | depth = root.depth + 1, 73 | displayName = "" 74 | }; 75 | group.Initialize(m_Snapshot, type); 76 | 77 | lookup[type.name] = parent = group; 78 | root.AddChild(group); 79 | } 80 | 81 | // Create and add the managed object item 82 | var item = new ManagedObjectItem 83 | { 84 | id = m_UniqueId++, 85 | depth = parent.depth + 1, 86 | displayName = "" 87 | }; 88 | item.Initialize(this, m_Snapshot, obj); 89 | parent.AddChild(item); 90 | 91 | m_ManagedObjectCount++; 92 | m_ManagedObjectSize += item.size; 93 | } 94 | 95 | progress.value = 1; 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedEmptyShellObjectsView/ManagedEmptyShellObjectsControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88bb7a995b0fdc64c9741a7faf817456 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedEmptyShellObjectsView/ManagedEmptyShellObjectsView.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | using UnityEditor.IMGUI.Controls; 10 | using System; 11 | 12 | namespace HeapExplorer 13 | { 14 | public class ManagedEmptyShellObjectsView : AbstractManagedObjectsView 15 | { 16 | [InitializeOnLoadMethod] 17 | static void Register() 18 | { 19 | HeapExplorerWindow.Register(); 20 | } 21 | 22 | public override void Awake() 23 | { 24 | base.Awake(); 25 | 26 | titleContent = new GUIContent("C# Empty Shell Objects", ""); 27 | viewMenuOrder = 258; 28 | } 29 | 30 | protected override void OnCreate() 31 | { 32 | base.OnCreate(); 33 | 34 | var job = new Job(); 35 | job.snapshot = snapshot; 36 | job.control = (ManagedEmptyShellObjectsControl)m_ObjectsControl; 37 | ScheduleJob(job); 38 | } 39 | 40 | protected override AbstractManagedObjectsControl CreateObjectsTreeView(string editorPrefsKey, TreeViewState state) 41 | { 42 | return new ManagedEmptyShellObjectsControl(window, editorPrefsKey, state); 43 | } 44 | 45 | protected override void OnDrawHeader() 46 | { 47 | var text = string.Format("{0} empty shell object(s)", m_ObjectsControl.managedObjectsCount); 48 | window.SetStatusbarString(text); 49 | EditorGUILayout.LabelField(titleContent, EditorStyles.boldLabel); 50 | } 51 | 52 | public override void OnGUI() 53 | { 54 | base.OnGUI(); 55 | 56 | var control = (ManagedEmptyShellObjectsControl)m_ObjectsControl; 57 | if (control.progress.value < 1) 58 | { 59 | window.SetBusy(string.Format("Analyzing Managed Objects, {0:F0}% done", control.progress.value * 100)); 60 | } 61 | } 62 | 63 | class Job : AbstractThreadJob 64 | { 65 | public ManagedEmptyShellObjectsControl control; 66 | public PackedMemorySnapshot snapshot; 67 | 68 | // Output 69 | TreeViewItem tree; 70 | 71 | public override void ThreadFunc() 72 | { 73 | tree = control.BuildTree(snapshot); 74 | } 75 | 76 | public override void IntegrateFunc() 77 | { 78 | control.SetTree(tree); 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedEmptyShellObjectsView/ManagedEmptyShellObjectsView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 983cc0096cdb87442b9d585b8baa8413 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedHeapSectionsView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08a916969012c2c46a7b79c8aa72acd2 3 | folderAsset: yes 4 | timeCreated: 1527319053 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedHeapSectionsView/ManagedHeapSectionsControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 39304cba55e1e644982e75ba0510c646 3 | timeCreated: 1527319063 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedHeapSectionsView/ManagedHeapSectionsView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: add428a568f2f654687f967ba0808ca3 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedObjectDuplicatesView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 007cfcf1a5ae2b6468def8b52f35d28d 3 | folderAsset: yes 4 | timeCreated: 1527319053 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedObjectDuplicatesView/ManagedObjectDuplicatesControl.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEditor.IMGUI.Controls; 8 | using UnityEngine; 9 | 10 | namespace HeapExplorer 11 | { 12 | public class Progress 13 | { 14 | public float value; 15 | public string info = ""; 16 | } 17 | 18 | public class ManagedObjectDuplicatesControl : AbstractManagedObjectsControl 19 | { 20 | public Progress progress = new Progress(); 21 | 22 | public ManagedObjectDuplicatesControl(HeapExplorerWindow window, string editorPrefsKey, TreeViewState state) 23 | : base(window, editorPrefsKey, state) 24 | { 25 | } 26 | 27 | protected override void OnBuildTree(TreeViewItem root) 28 | { 29 | progress.value = 0; 30 | 31 | var lookup = new Dictionary(); 32 | var memoryReader = new MemoryReader(m_Snapshot); 33 | 34 | for (int n = 0, nend = m_Snapshot.managedObjects.Length; n < nend; ++n) 35 | { 36 | if (window.isClosing) // the window is closing 37 | break; 38 | 39 | progress.value = (n + 1.0f) / nend; 40 | 41 | var obj = m_Snapshot.managedObjects[n]; 42 | if (obj.address == 0) 43 | continue; 44 | 45 | var type = m_Snapshot.managedTypes[obj.managedTypesArrayIndex]; 46 | if (type.isPrimitive && !type.isPointer) 47 | continue; 48 | 49 | if (type.isValueType) 50 | continue; 51 | 52 | var hash = memoryReader.ComputeObjectHash(obj.address, type); 53 | 54 | AbstractItem parent; 55 | if (!lookup.TryGetValue(hash, out parent)) 56 | { 57 | var group = new GroupItem() 58 | { 59 | id = m_UniqueId++, 60 | depth = root.depth + 1, 61 | displayName = "" 62 | }; 63 | group.Initialize(m_Snapshot, type); 64 | 65 | lookup[hash] = parent = group; 66 | root.AddChild(group); 67 | } 68 | 69 | var item = new ManagedObjectItem 70 | { 71 | id = m_UniqueId++, 72 | depth = parent.depth + 1, 73 | displayName = "" 74 | }; 75 | item.Initialize(this, m_Snapshot, obj); 76 | parent.AddChild(item); 77 | } 78 | 79 | if (root.hasChildren) 80 | { 81 | for (var n = root.children.Count - 1; n >= 0; --n) 82 | { 83 | if (!root.children[n].hasChildren) 84 | { 85 | root.children.RemoveAt(n); 86 | continue; 87 | } 88 | 89 | if (root.children[n].children.Count < 2) 90 | { 91 | root.children.RemoveAt(n); 92 | continue; 93 | } 94 | 95 | var item = root.children[n] as AbstractItem; 96 | m_ManagedObjectCount += item.count; 97 | m_ManagedObjectSize += item.size; 98 | } 99 | } 100 | 101 | progress.value = 1; 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedObjectDuplicatesView/ManagedObjectDuplicatesControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50596694f3ecf714794beff4810a5fcb 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedObjectDuplicatesView/ManagedObjectDuplicatesView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b171c92a42c161c43a5c074cdf342bf5 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedObjectsView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52843b344fe7e054a9ba9e37d8adf490 3 | folderAsset: yes 4 | timeCreated: 1527319053 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedObjectsView/ManagedObjectsControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c4f7396a6a40414c958c6f25a021875 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedObjectsView/ManagedObjectsView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b474965b28d3b34ca36f1ddc1809a32 3 | timeCreated: 1527319063 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedTypesView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 491d732a09dd2644097b0906c6afd751 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedTypesView/ManagedTypesControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f5605b8e269b5e04ea91b59b3fea8ddd 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedTypesView/ManagedTypesView.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | using UnityEditor.IMGUI.Controls; 10 | 11 | namespace HeapExplorer 12 | { 13 | public class ManagedTypesView : HeapExplorerView 14 | { 15 | ManagedTypesControl m_TypesControl; 16 | HeSearchField m_TypesSearchField; 17 | PackedManagedType? m_Selected; 18 | float m_SplitterHorz = 0.33333f; 19 | float m_SplitterVert = 0.32f; 20 | 21 | [InitializeOnLoadMethod] 22 | static void Register() 23 | { 24 | HeapExplorerWindow.Register(); 25 | } 26 | 27 | public override void Awake() 28 | { 29 | base.Awake(); 30 | 31 | titleContent = new GUIContent("C# Types", ""); 32 | viewMenuOrder = 345; 33 | } 34 | 35 | protected override void OnCreate() 36 | { 37 | base.OnCreate(); 38 | 39 | m_TypesControl = new ManagedTypesControl(window, GetPrefsKey(() => m_TypesControl), new TreeViewState()); 40 | m_TypesControl.SetTree(m_TypesControl.BuildTree(snapshot)); 41 | m_TypesControl.onSelectionChange += OnListViewSelectionChange; 42 | 43 | m_TypesSearchField = new HeSearchField(window); 44 | m_TypesSearchField.downOrUpArrowKeyPressed += m_TypesControl.SetFocusAndEnsureSelectedItem; 45 | m_TypesControl.findPressed += m_TypesSearchField.SetFocus; 46 | 47 | m_SplitterHorz = EditorPrefs.GetFloat(GetPrefsKey(() => m_SplitterHorz), m_SplitterHorz); 48 | m_SplitterVert = EditorPrefs.GetFloat(GetPrefsKey(() => m_SplitterVert), m_SplitterVert); 49 | } 50 | 51 | protected override void OnHide() 52 | { 53 | base.OnHide(); 54 | 55 | m_TypesControl.SaveLayout(); 56 | 57 | EditorPrefs.SetFloat(GetPrefsKey(() => m_SplitterHorz), m_SplitterHorz); 58 | EditorPrefs.SetFloat(GetPrefsKey(() => m_SplitterVert), m_SplitterVert); 59 | } 60 | 61 | public override void RestoreCommand(GotoCommand command) 62 | { 63 | //m_TypesControl.Select(command.toGCHandle.packed); 64 | } 65 | 66 | //public override int CanProcessCommand(GotoCommand command) 67 | //{ 68 | // if (command.toGCHandle.isValid) 69 | // return 10; 70 | 71 | // return base.CanProcessCommand(command); 72 | //} 73 | 74 | //public override GotoCommand GetRestoreCommand() 75 | //{ 76 | // if (m_Selected.HasValue) 77 | // return new GotoCommand(new RichGCHandle(snapshot, m_Selected.Value.gcHandlesArrayIndex)); 78 | 79 | // return base.GetRestoreCommand(); 80 | //} 81 | 82 | // Called if the selection changed in the list that contains the managed objects overview. 83 | void OnListViewSelectionChange(PackedManagedType? type) 84 | { 85 | m_Selected = type; 86 | 87 | if (!type.HasValue) 88 | { 89 | return; 90 | } 91 | } 92 | 93 | public override void OnGUI() 94 | { 95 | base.OnGUI(); 96 | 97 | using (new EditorGUILayout.HorizontalScope()) 98 | { 99 | using (new EditorGUILayout.VerticalScope()) 100 | { 101 | using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel)) 102 | { 103 | using (new EditorGUILayout.HorizontalScope()) 104 | { 105 | EditorGUILayout.LabelField(string.Format("{0} C# Type(s)", snapshot.managedTypes.Length), EditorStyles.boldLabel); 106 | 107 | if (m_TypesSearchField.OnToolbarGUI()) 108 | m_TypesControl.Search(m_TypesSearchField.text); 109 | } 110 | GUILayout.Space(2); 111 | 112 | m_TypesControl.OnGUI(); 113 | } 114 | 115 | //m_SplitterVert = HeEditorGUILayout.VerticalSplitter("m_splitterVert".GetHashCode(), m_SplitterVert, 0.1f, 0.8f, window); 116 | 117 | //using (new EditorGUILayout.HorizontalScope(GUILayout.Height(window.position.height * m_SplitterVert))) 118 | //{ 119 | // m_ConnectionsView.OnGUI(); 120 | //} 121 | } 122 | 123 | //m_SplitterHorz = HeEditorGUILayout.HorizontalSplitter("m_splitterHorz".GetHashCode(), m_SplitterHorz, 0.1f, 0.8f, window); 124 | 125 | //using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel, GUILayout.Width(window.position.width * m_SplitterHorz))) 126 | //{ 127 | // m_RootPathView.OnGUI(); 128 | //} 129 | } 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /Editor/Scripts/ManagedTypesView/ManagedTypesView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ff43d2665cdcd34a9a98adb7c46d08d 3 | timeCreated: 1527319063 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/MemoryReader.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschraut/UnityHeapExplorer/e2c2e916c78674fb7ce1855064f6af642cb9c671/Editor/Scripts/MemoryReader.cs -------------------------------------------------------------------------------- /Editor/Scripts/MemoryReader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3fd557e4e772ee142828afa0c4bfa03b 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/MemoryWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f3298e5a1e676aa43b516882c8725b37 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/NativeObjectsView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec5714aaab5e0d348b2bdae115f1801c 3 | folderAsset: yes 4 | timeCreated: 1527319054 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/NativeObjectsView/AbstractNativeObjectsView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8eba05753aa381c4495f7c49b96c4ded 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Scripts/NativeObjectsView/NativeObjectControl.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor.IMGUI.Controls; 9 | using UnityEditor; 10 | 11 | namespace HeapExplorer 12 | { 13 | /// 14 | /// The NativeObjectControl class provides the ability to display properties of a native UnityEngine object, 15 | /// such as a Mesh or MonoScript. 16 | /// 17 | sealed public class NativeObjectControl : AbstractTreeView 18 | { 19 | PackedMemorySnapshot m_Snapshot; 20 | PackedNativeUnityEngineObject m_Object; 21 | int m_UniqueId = 1; 22 | 23 | public NativeObjectControl(HeapExplorerWindow window, string editorPrefsKey, TreeViewState state) 24 | : base(window, editorPrefsKey, state, new MultiColumnHeader( 25 | new MultiColumnHeaderState(new[] 26 | { 27 | new MultiColumnHeaderState.Column() { headerContent = new GUIContent("Name"), width = 200 }, 28 | new MultiColumnHeaderState.Column() { headerContent = new GUIContent("Value"), width = 200 } 29 | }))) 30 | { 31 | multiColumnHeader.canSort = false; 32 | 33 | Reload(); 34 | } 35 | 36 | public void Inspect(PackedMemorySnapshot snapshot, PackedNativeUnityEngineObject nativeObject) 37 | { 38 | m_Snapshot = snapshot; 39 | m_Object = nativeObject; 40 | 41 | Reload(); 42 | } 43 | 44 | public void Clear() 45 | { 46 | m_Snapshot = null; 47 | Reload(); 48 | } 49 | 50 | protected override TreeViewItem BuildRoot() 51 | { 52 | var root = new TreeViewItem { id = 0, depth = -1, displayName = "Root" }; 53 | if (m_Snapshot == null) 54 | { 55 | root.AddChild(new TreeViewItem { id = 1, depth = -1, displayName = "" }); 56 | return root; 57 | } 58 | 59 | AddTreeViewItem(root, new Item() { displayName = "Name", value = m_Object.name }); 60 | AddTreeViewItem(root, new Item() { displayName = "Type", value = m_Snapshot.nativeTypes[m_Object.nativeTypesArrayIndex].name }); 61 | AddTreeViewItem(root, new Item() { displayName = "Size", value = EditorUtility.FormatBytes(m_Object.size) }); 62 | AddTreeViewItem(root, new Item() { displayName = "Address", value = string.Format(StringFormat.Address, m_Object.nativeObjectAddress) }); 63 | AddTreeViewItem(root, new Item() { displayName = "InstanceID", value = m_Object.instanceId.ToString() }); 64 | AddTreeViewItem(root, new Item() { displayName = "Persistent", value = m_Object.isPersistent.ToString() }); 65 | AddTreeViewItem(root, new Item() { displayName = "DontDestroyOnLoad", value = m_Object.isDontDestroyOnLoad.ToString() }); 66 | AddTreeViewItem(root, new Item() { displayName = "IsManager", value = m_Object.isManager.ToString() }); 67 | AddTreeViewItem(root, new Item() { displayName = "HideFlags", value = m_Object.hideFlags.ToString() }); 68 | 69 | return root; 70 | } 71 | 72 | protected override int OnSortItem(TreeViewItem x, TreeViewItem y) 73 | { 74 | return 0; 75 | } 76 | 77 | void AddTreeViewItem(TreeViewItem parent, TreeViewItem item) 78 | { 79 | item.id = m_UniqueId++; 80 | item.depth = parent.depth + 1; 81 | parent.AddChild(item); 82 | } 83 | 84 | class Item : AbstractTreeViewItem 85 | { 86 | public string value; 87 | 88 | public override void OnGUI(Rect position, int column) 89 | { 90 | switch (column) 91 | { 92 | case 0: 93 | EditorGUI.LabelField(position, displayName); 94 | break; 95 | case 1: 96 | EditorGUI.LabelField(position, value); 97 | break; 98 | } 99 | } 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /Editor/Scripts/NativeObjectsView/NativeObjectControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f05bc628b167712409e0c32fb3f2e466 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/NativeObjectsView/NativeObjectDuplicatesView.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor.IMGUI.Controls; 9 | using UnityEditor; 10 | 11 | namespace HeapExplorer 12 | { 13 | public class NativeObjectDuplicatesView : AbstractNativeObjectsView 14 | { 15 | // https://docs.unity3d.com/Manual/BestPracticeUnderstandingPerformanceInUnity2.html 16 | 17 | Job m_job; 18 | 19 | [InitializeOnLoadMethod] 20 | static void Register() 21 | { 22 | HeapExplorerWindow.Register(); 23 | } 24 | 25 | public override void Awake() 26 | { 27 | base.Awake(); 28 | 29 | titleContent = new GUIContent("C++ Asset Duplicates (guessed)", ""); 30 | viewMenuOrder = 560; 31 | } 32 | 33 | protected override void OnRebuild() 34 | { 35 | base.OnRebuild(); 36 | 37 | m_job = new Job(); 38 | m_job.control = m_NativeObjectsControl; 39 | m_job.snapshot = snapshot; 40 | m_job.buildArgs.addAssetObjects = this.showAssets; 41 | m_job.buildArgs.addSceneObjects = this.showSceneObjects; 42 | m_job.buildArgs.addRuntimeObjects = this.showRuntimeObjects; 43 | m_job.buildArgs.addDestroyOnLoad = this.showDestroyOnLoadObjects; 44 | m_job.buildArgs.addDontDestroyOnLoad = this.showDontDestroyOnLoadObjects; 45 | ScheduleJob(m_job); 46 | } 47 | 48 | protected override void OnDrawHeader() 49 | { 50 | base.OnDrawHeader(); 51 | 52 | EditorGUILayout.LabelField(titleContent, EditorStyles.boldLabel); 53 | 54 | var text = string.Format("{0} native UnityEngine object guessed duplicate(s) wasting {1} memory", m_NativeObjectsControl.nativeObjectsCount, EditorUtility.FormatBytes(m_NativeObjectsControl.nativeObjectsSize)); 55 | window.SetStatusbarString(text); 56 | } 57 | 58 | public override void OnGUI() 59 | { 60 | base.OnGUI(); 61 | 62 | if (m_job != null && m_job.state != AbstractThreadJob.State.Completed) 63 | window.SetBusy("Working..."); 64 | else if (m_job != null && m_job.state == AbstractThreadJob.State.Completed) 65 | m_job = null; 66 | } 67 | 68 | class Job : AbstractThreadJob 69 | { 70 | public NativeObjectsControl control; 71 | public PackedMemorySnapshot snapshot; 72 | public NativeObjectsControl.BuildArgs buildArgs; 73 | 74 | // Output 75 | TreeViewItem tree; 76 | 77 | public override void ThreadFunc() 78 | { 79 | tree = control.BuildDuplicatesTree(snapshot, buildArgs); 80 | } 81 | 82 | public override void IntegrateFunc() 83 | { 84 | control.SetTree(tree); 85 | } 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /Editor/Scripts/NativeObjectsView/NativeObjectDuplicatesView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d991fdda4f22d647bacb30ef35cae57 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Scripts/NativeObjectsView/NativeObjectPreviewView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ff8826c0a9388e47a7979920e5acea2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Scripts/NativeObjectsView/NativeObjectsControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f227dba91a8074448ba01908e05ed9b 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/NativeObjectsView/NativeObjectsView.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor.IMGUI.Controls; 9 | using UnityEditor; 10 | 11 | namespace HeapExplorer 12 | { 13 | public class NativeObjectsView : AbstractNativeObjectsView 14 | { 15 | Job m_Job; 16 | 17 | [InitializeOnLoadMethod] 18 | static void Register() 19 | { 20 | HeapExplorerWindow.Register(); 21 | } 22 | 23 | public override void Awake() 24 | { 25 | base.Awake(); 26 | 27 | titleContent = new GUIContent("C++ Objects", ""); 28 | viewMenuOrder = 550; 29 | } 30 | 31 | public override int CanProcessCommand(GotoCommand command) 32 | { 33 | if (command.toNativeObject.isValid) 34 | return 10; 35 | 36 | return base.CanProcessCommand(command); 37 | } 38 | 39 | protected override void OnRebuild() 40 | { 41 | base.OnRebuild(); 42 | 43 | m_Job = new Job(); 44 | m_Job.control = m_NativeObjectsControl; 45 | m_Job.snapshot = snapshot; 46 | m_Job.buildArgs.addAssetObjects = this.showAssets; 47 | m_Job.buildArgs.addSceneObjects = this.showSceneObjects; 48 | m_Job.buildArgs.addRuntimeObjects = this.showRuntimeObjects; 49 | m_Job.buildArgs.addDestroyOnLoad = this.showDestroyOnLoadObjects; 50 | m_Job.buildArgs.addDontDestroyOnLoad = this.showDontDestroyOnLoadObjects; 51 | ScheduleJob(m_Job); 52 | } 53 | 54 | protected override void OnDrawHeader() 55 | { 56 | base.OnDrawHeader(); 57 | 58 | EditorGUILayout.LabelField(titleContent, EditorStyles.boldLabel); 59 | 60 | var text = string.Format("{0} native UnityEngine object(s) using {1} memory", m_NativeObjectsControl.nativeObjectsCount, EditorUtility.FormatBytes(m_NativeObjectsControl.nativeObjectsSize)); 61 | window.SetStatusbarString(text); 62 | } 63 | 64 | public override void OnGUI() 65 | { 66 | base.OnGUI(); 67 | 68 | if (m_Job != null && m_Job.state != AbstractThreadJob.State.Completed) 69 | window.SetBusy("Working..."); 70 | else if (m_Job != null && m_Job.state == AbstractThreadJob.State.Completed) 71 | m_Job = null; 72 | } 73 | 74 | class Job : AbstractThreadJob 75 | { 76 | public NativeObjectsControl control; 77 | public PackedMemorySnapshot snapshot; 78 | public NativeObjectsControl.BuildArgs buildArgs; 79 | 80 | // Output 81 | TreeViewItem tree; 82 | 83 | public override void ThreadFunc() 84 | { 85 | tree = control.BuildTree(snapshot, buildArgs); 86 | } 87 | 88 | public override void IntegrateFunc() 89 | { 90 | control.SetTree(tree); 91 | } 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /Editor/Scripts/NativeObjectsView/NativeObjectsView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1cc74b63f41d8cc4aae83681eb1b954b 3 | timeCreated: 1527319063 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/OverviewView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a3448b557c048e4eba6ed57075a180f 3 | folderAsset: yes 4 | timeCreated: 1527319053 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/OverviewView/OverviewView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 629c1b69adb477a4fb415fcbb3c044f2 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c4a6d9a8182714d4fa8eff489e825985 3 | folderAsset: yes 4 | timeCreated: 1527319053 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedConnection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c42565eab93e6e0449dff39eca080f19 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedCoreTypes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using System; 9 | 10 | namespace HeapExplorer 11 | { 12 | /// 13 | /// The PackedCoreTypes class contains indexes for various types to their 14 | /// type definition as found in the memory snapshot. 15 | /// 16 | public class PackedCoreTypes 17 | { 18 | // Indexes in PackedMemorySnapshot.managedTypes array 19 | public int systemEnum = -1; 20 | public int systemByte = -1; 21 | public int systemSByte = -1; 22 | public int systemChar = -1; 23 | public int systemBoolean = -1; 24 | public int systemSingle = -1; 25 | public int systemDouble = -1; 26 | public int systemDecimal = -1; 27 | public int systemInt16 = -1; 28 | public int systemUInt16 = -1; 29 | public int systemInt32 = -1; 30 | public int systemUInt32 = -1; 31 | public int systemInt64 = -1; 32 | public int systemUInt64 = -1; 33 | public int systemIntPtr = -1; 34 | public int systemUIntPtr = -1; 35 | public int systemString = -1; 36 | public int systemValueType = -1; 37 | public int systemReferenceType = -1; 38 | public int systemObject = -1; 39 | public int systemDelegate = -1; 40 | public int systemMulticastDelegate = -1; 41 | 42 | // Indexes in PackedMemorySnapshot.managedTypes array 43 | public int unityEngineObject = -1; 44 | public int unityEngineGameObject = -1; 45 | public int unityEngineTransform = -1; 46 | public int unityEngineRectTransform = -1; 47 | public int unityEngineMonoBehaviour = -1; 48 | public int unityEngineMonoScript = -1; 49 | public int unityEngineComponent = -1; 50 | public int unityEngineScriptableObject = -1; 51 | public int unityEngineAssetBundle = -1; 52 | 53 | // Indexes in PackedMemorySnapshot.nativeTypes array 54 | public int nativeObject = -1; 55 | public int nativeGameObject = -1; 56 | public int nativeMonoBehaviour = -1; 57 | public int nativeMonoScript = -1; 58 | public int nativeScriptableObject = -1; 59 | public int nativeTransform = -1; 60 | public int nativeComponent = -1; 61 | public int nativeAssetBundle = -1; 62 | 63 | // Indexes in PackedMemorySnapshot.nativeTypes array 64 | public int nativeTexture2D = -1; 65 | public int nativeTexture3D = -1; 66 | public int nativeTextureArray = -1; 67 | public int nativeAudioClip = -1; 68 | public int nativeAnimationClip = -1; 69 | public int nativeMesh = -1; 70 | public int nativeMaterial = -1; 71 | public int nativeSprite = -1; 72 | public int nativeShader = -1; 73 | public int nativeAnimatorController = -1; 74 | public int nativeCubemap = -1; 75 | public int nativeCubemapArray = -1; 76 | public int nativeFont = -1; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedCoreTypes.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6bb0a8446f07a1a4e85d2d0fdb3ffa64 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedGCHandle.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | using System; 10 | 11 | namespace HeapExplorer 12 | { 13 | /// 14 | /// A description of a GC handle used by the virtual machine. 15 | /// 16 | /// 17 | /// A GCHandle is a struct that contains a handle to an object. 18 | /// It's mainly used for holding onto a managed object that gets passed to the unmanaged world to prevent the GC from collecting the object. 19 | /// You can also create a Pinned GCHandle to a managed object and retrieve the object's address in memory. 20 | /// https://blogs.msdn.microsoft.com/clyon/2005/03/18/the-truth-about-gchandles/ 21 | /// 22 | [Serializable] 23 | [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, Pack = 1)] 24 | public struct PackedGCHandle 25 | { 26 | // The address of the managed object that the GC handle is referencing. 27 | public System.UInt64 target; 28 | 29 | [NonSerialized] public System.Int32 gcHandlesArrayIndex; 30 | [NonSerialized] public System.Int32 managedObjectsArrayIndex; 31 | 32 | const System.Int32 k_Version = 1; 33 | 34 | public static void Write(System.IO.BinaryWriter writer, PackedGCHandle[] value) 35 | { 36 | writer.Write(k_Version); 37 | writer.Write(value.Length); 38 | 39 | for (int n = 0, nend = value.Length; n < nend; ++n) 40 | { 41 | writer.Write(value[n].target); 42 | } 43 | } 44 | 45 | public static void Read(System.IO.BinaryReader reader, out PackedGCHandle[] value, out string stateString) 46 | { 47 | value = new PackedGCHandle[0]; 48 | stateString = ""; 49 | 50 | var version = reader.ReadInt32(); 51 | if (version >= 1) 52 | { 53 | var length = reader.ReadInt32(); 54 | stateString = string.Format("Loading {0} GC Handles", length); 55 | value = new PackedGCHandle[length]; 56 | 57 | for (int n = 0, nend = value.Length; n < nend; ++n) 58 | { 59 | value[n].target = reader.ReadUInt64(); 60 | value[n].gcHandlesArrayIndex = n; 61 | value[n].managedObjectsArrayIndex = -1; 62 | } 63 | } 64 | } 65 | 66 | public static PackedGCHandle[] FromMemoryProfiler(UnityEditor.Profiling.Memory.Experimental.PackedMemorySnapshot snapshot) 67 | { 68 | var source = snapshot.gcHandles; 69 | var value = new PackedGCHandle[source.GetNumEntries()]; 70 | 71 | var sourceTargets = new ulong[source.target.GetNumEntries()]; 72 | source.target.GetEntries(0, source.target.GetNumEntries(), ref sourceTargets); 73 | 74 | for (int n = 0, nend = value.Length; n < nend; ++n) 75 | { 76 | value[n] = new PackedGCHandle 77 | { 78 | target = sourceTargets[n], 79 | gcHandlesArrayIndex = n, 80 | managedObjectsArrayIndex = -1, 81 | }; 82 | } 83 | return value; 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedGCHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f24a2f1559efbd45a99dc2d45a7232d 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedManagedField.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | using System; 10 | 11 | namespace HeapExplorer 12 | { 13 | // Description of a field of a managed type. 14 | [Serializable] 15 | [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, Pack = 1)] 16 | public struct PackedManagedField 17 | { 18 | // Offset of this field. 19 | public System.Int32 offset; 20 | 21 | // The typeindex into PackedMemorySnapshot.typeDescriptions of the type this field belongs to. 22 | public System.Int32 managedTypesArrayIndex; 23 | 24 | // Name of this field. 25 | public System.String name; 26 | 27 | // Is this field static? 28 | public System.Boolean isStatic; 29 | 30 | [NonSerialized] public bool isBackingField; 31 | 32 | const System.Int32 k_Version = 1; 33 | 34 | public static void Write(System.IO.BinaryWriter writer, PackedManagedField[] value) 35 | { 36 | writer.Write(k_Version); 37 | writer.Write(value.Length); 38 | 39 | for (int n = 0, nend = value.Length; n < nend; ++n) 40 | { 41 | writer.Write(value[n].name); 42 | writer.Write(value[n].offset); 43 | writer.Write(value[n].managedTypesArrayIndex); 44 | writer.Write(value[n].isStatic); 45 | } 46 | } 47 | 48 | public static void Read(System.IO.BinaryReader reader, out PackedManagedField[] value) 49 | { 50 | value = new PackedManagedField[0]; 51 | 52 | var version = reader.ReadInt32(); 53 | if (version >= 1) 54 | { 55 | var length = reader.ReadInt32(); 56 | value = new PackedManagedField[length]; 57 | 58 | for (int n = 0, nend = value.Length; n < nend; ++n) 59 | { 60 | value[n].name = reader.ReadString(); 61 | value[n].offset = reader.ReadInt32(); 62 | value[n].managedTypesArrayIndex = reader.ReadInt32(); 63 | value[n].isStatic = reader.ReadBoolean(); 64 | } 65 | } 66 | } 67 | 68 | public override string ToString() 69 | { 70 | var text = string.Format("name: {0}, offset: {1}, typeIndex: {2}, isStatic: {3}", name, offset, managedTypesArrayIndex, isStatic); 71 | return text; 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedManagedField.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 00650d561f8b4ec45962fbcba9205677 3 | timeCreated: 1527319062 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedManagedObject.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | using System; 10 | 11 | namespace HeapExplorer 12 | { 13 | [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, Pack = 1)] 14 | public struct PackedManagedObject 15 | { 16 | // The address of the managed object 17 | public System.UInt64 address; 18 | 19 | // If this object is a static field 20 | public System.Byte[] staticBytes; 21 | 22 | // The managed type of this managed object 23 | public System.Int32 managedTypesArrayIndex; 24 | 25 | // An index into the managedObjects array of the snapshot that stores this managed object 26 | public System.Int32 managedObjectsArrayIndex; 27 | 28 | // The index into the gcHandles array of the snapshot that is connected to this managed object, if any. 29 | public System.Int32 gcHandlesArrayIndex; 30 | 31 | // The index into the nativeObjects array of the snapshot that is connected to this managed object, if any. 32 | public System.Int32 nativeObjectsArrayIndex; 33 | 34 | // Size in bytes of this object. 35 | // ValueType arrays = count * sizeof(element) 36 | // ReferenceType arrays = count * sizeof(pointer) 37 | // String = length * sizeof(wchar) + strlen("\0\0") 38 | public System.Int32 size; 39 | 40 | public static PackedManagedObject New() 41 | { 42 | return new PackedManagedObject() 43 | { 44 | managedTypesArrayIndex = -1, 45 | managedObjectsArrayIndex = -1, 46 | gcHandlesArrayIndex = -1, 47 | nativeObjectsArrayIndex = -1, 48 | }; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedManagedObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d93d35c7d283f4044bb73539e1fb8010 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedManagedObjectCrawler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6452c414cfbaa645bfb2454a7726721 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedManagedStaticField.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | 9 | namespace HeapExplorer 10 | { 11 | [Serializable] 12 | [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, Pack = 1)] 13 | public struct PackedManagedStaticField 14 | { 15 | // The index into PackedMemorySnapshot.typeDescriptions of the type this field belongs to. 16 | public System.Int32 managedTypesArrayIndex; 17 | 18 | // The index into the typeDescription.fields array 19 | public System.Int32 fieldIndex; 20 | 21 | // The index into the PackedMemorySnapshot.staticFields array 22 | public System.Int32 staticFieldsArrayIndex; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedManagedStaticField.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a01d7a16825d823479e550e4df597f27 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedManagedType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 767310df0affc5b4da1b842e939554b0 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedMemorySection.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | using System; 10 | 11 | namespace HeapExplorer 12 | { 13 | // A dump of a piece of memory from the player that's being profiled. 14 | [Serializable] 15 | [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, Pack = 1)] 16 | public struct PackedMemorySection 17 | { 18 | // The actual bytes of the memory dump. 19 | public System.Byte[] bytes; 20 | 21 | // The start address of this piece of memory. 22 | public System.UInt64 startAddress; 23 | 24 | // The index into the snapshot.managedHeapSections array 25 | [System.NonSerialized] 26 | public int arrayIndex; 27 | 28 | public ulong size 29 | { 30 | get 31 | { 32 | if (bytes != null) 33 | return (ulong)bytes.LongLength; 34 | return 0; 35 | } 36 | } 37 | 38 | const System.Int32 k_Version = 1; 39 | 40 | public static void Write(System.IO.BinaryWriter writer, PackedMemorySection[] value) 41 | { 42 | writer.Write(k_Version); 43 | writer.Write(value.Length); 44 | 45 | for (int n = 0, nend = value.Length; n < nend; ++n) 46 | { 47 | writer.Write((System.Int32)value[n].bytes.Length); 48 | writer.Write(value[n].bytes); 49 | writer.Write(value[n].startAddress); 50 | } 51 | } 52 | 53 | public static void Read(System.IO.BinaryReader reader, out PackedMemorySection[] value, out string stateString) 54 | { 55 | value = new PackedMemorySection[0]; 56 | stateString = ""; 57 | 58 | var version = reader.ReadInt32(); 59 | if (version >= 1) 60 | { 61 | var length = reader.ReadInt32(); 62 | value = new PackedMemorySection[length]; 63 | 64 | var onePercent = Math.Max(1, value.Length / 100); 65 | for (int n = 0, nend = value.Length; n < nend; ++n) 66 | { 67 | if ((n % onePercent) == 0) 68 | stateString = string.Format("Loading Managed Heap Sections\n{0}/{1}, {2:F0}% done", n + 1, length, ((n + 1) / (float)length) * 100); 69 | 70 | var count = reader.ReadInt32(); 71 | value[n].bytes = reader.ReadBytes(count); 72 | value[n].startAddress = reader.ReadUInt64(); 73 | value[n].arrayIndex = -1; 74 | } 75 | } 76 | } 77 | 78 | public static PackedMemorySection[] FromMemoryProfiler(UnityEditor.Profiling.Memory.Experimental.PackedMemorySnapshot snapshot) 79 | { 80 | var source = snapshot.managedHeapSections; 81 | var value = new PackedMemorySection[source.GetNumEntries()]; 82 | 83 | var sourceBytes = new byte[source.bytes.GetNumEntries()][]; 84 | source.bytes.GetEntries(0, source.bytes.GetNumEntries(), ref sourceBytes); 85 | 86 | var sourceStartAddresses = new ulong[source.startAddress.GetNumEntries()]; 87 | source.startAddress.GetEntries(0, source.startAddress.GetNumEntries(), ref sourceStartAddresses); 88 | 89 | for (int n = 0, nend = value.Length; n < nend; ++n) 90 | { 91 | value[n] = new PackedMemorySection 92 | { 93 | bytes = sourceBytes[n], 94 | startAddress = sourceStartAddresses[n], 95 | arrayIndex = -1 96 | }; 97 | } 98 | return value; 99 | } 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedMemorySection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 119457d8f244b194f8e15410aaa771f9 3 | timeCreated: 1527319062 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedMemorySnapshot.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b86bc4333fabd364ab376309149ccd20 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedMemorySnapshotEx.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: efe9df2f89642884ba3d37a7bb4bac46 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedMemorySnapshotHeader.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | 9 | namespace HeapExplorer 10 | { 11 | public class PackedMemorySnapshotHeader 12 | { 13 | const System.Int32 k_Magic = 'p' << 24 | 'a' << 16 | 'e' << 8 | 'h'; 14 | const int k_Version = 2; 15 | static string s_EditorVersion=""; 16 | static string s_EditorPlatform=""; 17 | 18 | public System.Int32 snapshotMagic = 0; 19 | public System.Int32 snapshotVersion = 0; 20 | public System.String editorVersion = ""; 21 | public System.String editorPlatform = ""; 22 | public System.String comment = ""; 23 | 24 | public bool nativeObjectFromConnectionsExcluded; 25 | 26 | public bool isValid 27 | { 28 | get 29 | { 30 | return snapshotMagic == k_Magic; 31 | } 32 | } 33 | 34 | [UnityEditor.InitializeOnLoadMethod] 35 | static void CacheData() 36 | { 37 | // Unity does not allow to read the Application.version from another thread, 38 | // so we have this workaround to cache the information... 39 | s_EditorVersion = Application.version; 40 | s_EditorPlatform = Application.platform.ToString(); 41 | } 42 | 43 | public static PackedMemorySnapshotHeader FromMemoryProfiler() 44 | { 45 | var value = new PackedMemorySnapshotHeader(); 46 | value.snapshotMagic = k_Magic; 47 | value.snapshotVersion = k_Version; 48 | value.editorVersion = s_EditorVersion; 49 | value.editorPlatform = s_EditorPlatform; 50 | value.comment = ""; 51 | return value; 52 | } 53 | 54 | public static void Write(System.IO.BinaryWriter writer, PackedMemorySnapshotHeader value) 55 | { 56 | value.snapshotMagic = k_Magic; 57 | value.snapshotVersion = k_Version; 58 | value.editorVersion = s_EditorVersion; 59 | value.editorPlatform = s_EditorPlatform; 60 | 61 | writer.Write(value.snapshotMagic); 62 | writer.Write(value.snapshotVersion); 63 | writer.Write(value.editorVersion); 64 | writer.Write(value.editorPlatform); 65 | writer.Write(value.comment); 66 | writer.Write(value.nativeObjectFromConnectionsExcluded); 67 | } 68 | 69 | public static void Read(System.IO.BinaryReader reader, out PackedMemorySnapshotHeader value, out string stateString) 70 | { 71 | value = new PackedMemorySnapshotHeader(); 72 | stateString = "Loading Header"; 73 | 74 | value.snapshotMagic = reader.ReadInt32(); 75 | if (!value.isValid) 76 | return; 77 | 78 | value.snapshotVersion = reader.ReadInt32(); 79 | value.editorVersion = reader.ReadString(); 80 | value.editorPlatform = reader.ReadString(); 81 | value.comment = reader.ReadString(); 82 | 83 | if (value.snapshotVersion >= 2) 84 | value.nativeObjectFromConnectionsExcluded = reader.ReadBoolean(); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedMemorySnapshotHeader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e3e11a6cbce34dc4480a5ace25fdd50f 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedNativeType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | using System; 10 | 11 | namespace HeapExplorer 12 | { 13 | [Serializable] 14 | [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential, Pack = 1)] 15 | public struct PackedNativeType 16 | { 17 | // The index used to obtain the native C++ base class description from the PackedMemorySnapshot.nativeTypes array. 18 | public System.Int32 nativeBaseTypeArrayIndex; 19 | 20 | [NonSerialized] 21 | public System.Int32 nativeTypeArrayIndex; 22 | 23 | [NonSerialized] 24 | public System.Int32 managedTypeArrayIndex; 25 | 26 | // Number of all objects of this type. 27 | [NonSerialized] 28 | public System.Int32 totalObjectCount; 29 | 30 | // The size of all objects of this type. 31 | [NonSerialized] 32 | public System.Int64 totalObjectSize; 33 | 34 | // Name of this C++ unity type. 35 | public System.String name; 36 | 37 | const System.Int32 k_Version = 1; 38 | 39 | public static readonly PackedNativeType invalid = new PackedNativeType() 40 | { 41 | name = "", 42 | nativeBaseTypeArrayIndex = -1, 43 | nativeTypeArrayIndex = -1, 44 | managedTypeArrayIndex = -1 45 | }; 46 | 47 | /// 48 | /// Writes a PackedNativeType array to the specified writer. 49 | /// 50 | public static void Write(System.IO.BinaryWriter writer, PackedNativeType[] value) 51 | { 52 | writer.Write(k_Version); 53 | writer.Write(value.Length); 54 | 55 | for (int n = 0, nend = value.Length; n < nend; ++n) 56 | { 57 | writer.Write(value[n].name); 58 | writer.Write(value[n].nativeBaseTypeArrayIndex); 59 | } 60 | } 61 | 62 | /// 63 | /// Reads a PackedNativeType array from the specified reader and stores the result in the specified value. 64 | /// 65 | public static void Read(System.IO.BinaryReader reader, out PackedNativeType[] value, out string stateString) 66 | { 67 | value = new PackedNativeType[0]; 68 | stateString = ""; 69 | 70 | var version = reader.ReadInt32(); 71 | if (version >= 1) 72 | { 73 | var length = reader.ReadInt32(); 74 | stateString = string.Format("Loading {0} Native Types", length); 75 | 76 | value = new PackedNativeType[length]; 77 | 78 | for (int n = 0, nend = value.Length; n < nend; ++n) 79 | { 80 | value[n].name = reader.ReadString(); 81 | value[n].nativeBaseTypeArrayIndex = reader.ReadInt32(); 82 | value[n].nativeTypeArrayIndex = n; 83 | value[n].managedTypeArrayIndex = -1; 84 | } 85 | } 86 | } 87 | 88 | public static PackedNativeType[] FromMemoryProfiler(UnityEditor.Profiling.Memory.Experimental.PackedMemorySnapshot snapshot) 89 | { 90 | var source = snapshot.nativeTypes; 91 | var value = new PackedNativeType[source.GetNumEntries()]; 92 | 93 | var sourceTypeName = new string[source.typeName.GetNumEntries()]; 94 | source.typeName.GetEntries(0, source.typeName.GetNumEntries(), ref sourceTypeName); 95 | 96 | var sourceNativeBaseTypeArrayIndex = new int[source.nativeBaseTypeArrayIndex.GetNumEntries()]; 97 | source.nativeBaseTypeArrayIndex.GetEntries(0, source.nativeBaseTypeArrayIndex.GetNumEntries(), ref sourceNativeBaseTypeArrayIndex); 98 | 99 | for (int n = 0, nend = value.Length; n < nend; ++n) 100 | { 101 | value[n] = new PackedNativeType 102 | { 103 | name = sourceTypeName[n], 104 | nativeBaseTypeArrayIndex = sourceNativeBaseTypeArrayIndex[n], 105 | nativeTypeArrayIndex = n, 106 | managedTypeArrayIndex = -1, 107 | }; 108 | }; 109 | 110 | return value; 111 | } 112 | 113 | 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedNativeType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca442f418217103438fced3f0c0799fe 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedNativeUnityEngineObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc8bdaf772f9c3b46b8f3024c16cc7c8 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedVirtualMachineInformation.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | using System; 10 | 11 | namespace HeapExplorer 12 | { 13 | // Information about a virtual machine that provided a memory snapshot. 14 | [Serializable] 15 | public struct PackedVirtualMachineInformation 16 | { 17 | // Size in bytes of a pointer. 18 | public System.Int32 pointerSize; 19 | 20 | // Size in bytes of the header of each managed object. 21 | public System.Int32 objectHeaderSize; 22 | 23 | // Size in bytes of the header of an array object. 24 | public System.Int32 arrayHeaderSize; 25 | 26 | // Offset in bytes inside the object header of an array object where the bounds of the array is stored. 27 | public System.Int32 arrayBoundsOffsetInHeader; 28 | 29 | // Offset in bytes inside the object header of an array object where the size of the array is stored. 30 | public System.Int32 arraySizeOffsetInHeader; 31 | 32 | // Allocation granularity in bytes used by the virtual machine allocator. 33 | public System.Int32 allocationGranularity; 34 | 35 | // A version number that will change when the object layout inside the managed heap will change. 36 | public System.Int32 heapFormatVersion; 37 | 38 | const System.Int32 k_Version = 1; 39 | 40 | public static void Write(System.IO.BinaryWriter writer, PackedVirtualMachineInformation value) 41 | { 42 | writer.Write(k_Version); 43 | writer.Write(value.pointerSize); 44 | writer.Write(value.objectHeaderSize); 45 | writer.Write(value.arrayHeaderSize); 46 | writer.Write(value.arrayBoundsOffsetInHeader); 47 | writer.Write(value.arraySizeOffsetInHeader); 48 | writer.Write(value.allocationGranularity); 49 | writer.Write(value.heapFormatVersion); 50 | } 51 | 52 | public static void Read(System.IO.BinaryReader reader, out PackedVirtualMachineInformation value, out string stateString) 53 | { 54 | value = new PackedVirtualMachineInformation(); 55 | stateString = "Loading VM Information"; 56 | 57 | var version = reader.ReadInt32(); 58 | if (version >= 1) 59 | { 60 | value.pointerSize = reader.ReadInt32(); 61 | value.objectHeaderSize = reader.ReadInt32(); 62 | value.arrayHeaderSize = reader.ReadInt32(); 63 | value.arrayBoundsOffsetInHeader = reader.ReadInt32(); 64 | value.arraySizeOffsetInHeader = reader.ReadInt32(); 65 | value.allocationGranularity = reader.ReadInt32(); 66 | value.heapFormatVersion = reader.ReadInt32(); 67 | } 68 | } 69 | 70 | public static PackedVirtualMachineInformation FromMemoryProfiler(UnityEditor.Profiling.Memory.Experimental.PackedMemorySnapshot snapshot) 71 | { 72 | var source = snapshot.virtualMachineInformation; 73 | 74 | var value = new PackedVirtualMachineInformation 75 | { 76 | pointerSize = source.pointerSize, 77 | objectHeaderSize = source.objectHeaderSize, 78 | arrayHeaderSize = source.arrayHeaderSize, 79 | arrayBoundsOffsetInHeader = source.arrayBoundsOffsetInHeader, 80 | arraySizeOffsetInHeader = source.arraySizeOffsetInHeader, 81 | allocationGranularity = source.allocationGranularity, 82 | heapFormatVersion = 2019, 83 | }; 84 | return value; 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Editor/Scripts/PackedTypes/PackedVirtualMachineInformation.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c403d4dff47912d47bd88df540aa5079 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 51f4e1c72c55c9144b89c05f540aac8f 3 | folderAsset: yes 4 | timeCreated: 1527319053 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/ArrayElementPropertyGridItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor.IMGUI.Controls; 9 | using UnityEditor; 10 | 11 | namespace HeapExplorer 12 | { 13 | public class ArrayElementPropertyGridItem : PropertyGridItem 14 | { 15 | public ArrayElementPropertyGridItem(PropertyGridControl owner, PackedMemorySnapshot snapshot, System.UInt64 address, AbstractMemoryReader memoryReader) 16 | : base(owner, snapshot, address, memoryReader) 17 | { 18 | } 19 | 20 | protected override void OnInitialize() 21 | { 22 | displayType = type.name; 23 | displayName = "element"; 24 | displayValue = m_MemoryReader.ReadFieldValueAsString(address, type); 25 | isExpandable = address > 0; 26 | icon = HeEditorStyles.GetTypeImage(m_Snapshot, type); 27 | 28 | if (type.isPointer) 29 | { 30 | var pointer = m_MemoryReader.ReadPointer(address); 31 | isExpandable = pointer > 0; 32 | enabled = pointer > 0; 33 | } 34 | } 35 | 36 | protected override void OnBuildChildren(System.Action add) 37 | { 38 | // this class is only a container for whatever ArrayPropertyGridItem is tossed in 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/ArrayElementPropertyGridItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f25f292d383c35f42bdc3e00344c4c33 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/ArrayPropertyGridItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b247ad5e957fe34db6114dee148283e 3 | timeCreated: 1527319063 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/BaseClassPropertyGridItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor.IMGUI.Controls; 9 | using UnityEditor; 10 | 11 | namespace HeapExplorer 12 | { 13 | public class BaseClassPropertyGridItem : PropertyGridItem 14 | { 15 | public BaseClassPropertyGridItem(PropertyGridControl owner, PackedMemorySnapshot snapshot, System.UInt64 address, AbstractMemoryReader memoryReader) 16 | : base(owner, snapshot, address, memoryReader) 17 | { 18 | } 19 | 20 | protected override void OnInitialize() 21 | { 22 | displayType = type.name; 23 | displayName = "base"; 24 | displayValue = type.name; 25 | isExpandable = true; 26 | } 27 | 28 | protected override void OnBuildChildren(System.Action add) 29 | { 30 | var args = new BuildChildrenArgs 31 | { 32 | parent = this, 33 | type = m_Snapshot.managedTypes[type.managedTypesArrayIndex], 34 | address = address, 35 | memoryReader = m_MemoryReader 36 | }; 37 | add(args); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/BaseClassPropertyGridItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ef3b698f7d2c9f6468ac1ea9310cc6ba 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/PrimitiveTypePropertyGridItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor.IMGUI.Controls; 9 | using UnityEditor; 10 | 11 | namespace HeapExplorer 12 | { 13 | public class PrimitiveTypePropertyGridItem : PropertyGridItem 14 | { 15 | public PackedManagedField field; 16 | 17 | public PrimitiveTypePropertyGridItem(PropertyGridControl owner, PackedMemorySnapshot snapshot, System.UInt64 address, AbstractMemoryReader memoryReader) 18 | : base(owner, snapshot, address, memoryReader) 19 | { 20 | } 21 | 22 | protected override void OnInitialize() 23 | { 24 | var type = m_Snapshot.managedTypes[field.managedTypesArrayIndex]; 25 | base.type = type; 26 | //typeIndex = type.managedTypesArrayIndex; 27 | displayType = type.name; 28 | if (field.isStatic) 29 | displayType = "static " + displayType; 30 | 31 | displayName = field.name; 32 | displayValue = m_MemoryReader.ReadFieldValueAsString(address, type); 33 | isExpandable = false; 34 | icon = HeEditorStyles.GetTypeImage(m_Snapshot, type); 35 | 36 | if (type.isPointer) 37 | enabled = m_MemoryReader.ReadPointer(address) > 0; 38 | } 39 | 40 | protected override void OnBuildChildren(System.Action add) 41 | { 42 | var args = new BuildChildrenArgs(); 43 | args.parent = this; 44 | args.type = m_Snapshot.managedTypes[field.managedTypesArrayIndex]; 45 | args.address = address; 46 | args.memoryReader = field.isStatic ? (AbstractMemoryReader)(new StaticMemoryReader(m_Snapshot, args.type.staticFieldBytes)) : (AbstractMemoryReader)(new MemoryReader(m_Snapshot));// m_memoryReader; 47 | add(args); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/PrimitiveTypePropertyGridItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c70ef604ab4da1d49a1ce5c1f151ba34 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/PropertyGridControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fcc50057c80afd14cbf9b1422be22e6e 3 | timeCreated: 1527319067 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/PropertyGridItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa212d131239f0346b4b6647648377d5 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/PropertyGridView.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | using UnityEditor.IMGUI.Controls; 10 | 11 | namespace HeapExplorer 12 | { 13 | public class PropertyGridView : HeapExplorerView 14 | { 15 | PropertyGridControl m_PropertyGrid; 16 | AbstractDataVisualizer m_DataVisualizer; 17 | Vector2 m_DataVisualizerScrollPos; 18 | RichManagedObject m_ManagedObject; 19 | RichManagedType m_ManagedType; 20 | bool m_ShowAsHex; 21 | HexView m_HexView; 22 | 23 | public override void Awake() 24 | { 25 | base.Awake(); 26 | 27 | titleContent = new GUIContent("C# Object", ""); 28 | } 29 | 30 | protected override void OnCreate() 31 | { 32 | base.OnCreate(); 33 | 34 | m_HexView = CreateView(); 35 | m_ShowAsHex = EditorPrefs.GetBool(GetPrefsKey(() => m_ShowAsHex), false); 36 | 37 | m_PropertyGrid = new PropertyGridControl(window, GetPrefsKey(() => m_PropertyGrid), new TreeViewState()); 38 | } 39 | 40 | protected override void OnHide() 41 | { 42 | base.OnHide(); 43 | 44 | EditorPrefs.SetBool(GetPrefsKey(() => m_ShowAsHex), m_ShowAsHex); 45 | } 46 | 47 | public override void OnGUI() 48 | { 49 | base.OnGUI(); 50 | 51 | using (new EditorGUILayout.VerticalScope()) 52 | { 53 | using (new EditorGUILayout.HorizontalScope()) 54 | { 55 | var label = "Field(s)"; 56 | if (m_ManagedType.isValid) 57 | label = m_ManagedType.name + " field(s)"; 58 | EditorGUILayout.LabelField(label, EditorStyles.boldLabel, GUILayout.ExpandWidth(true)); 59 | 60 | m_ShowAsHex = GUILayout.Toggle(m_ShowAsHex, new GUIContent(HeEditorStyles.eyeImage, "Show Memory"), EditorStyles.miniButton, GUILayout.Width(30), GUILayout.Height(17)); 61 | } 62 | 63 | if (m_ShowAsHex != m_HexView.isVisible) 64 | { 65 | if (m_ShowAsHex) 66 | m_HexView.Show(snapshot); 67 | else 68 | m_HexView.Hide(); 69 | } 70 | 71 | if (m_ShowAsHex) 72 | m_HexView.OnGUI(); 73 | else 74 | m_PropertyGrid.OnGUI(); 75 | } 76 | } 77 | 78 | public void Inspect(PackedManagedObject managedObject) 79 | { 80 | m_ManagedObject = new RichManagedObject(snapshot, managedObject.managedObjectsArrayIndex); 81 | m_ManagedType = m_ManagedObject.type; 82 | m_PropertyGrid.Inspect(snapshot, m_ManagedObject.packed); 83 | 84 | m_DataVisualizer = null; 85 | if (AbstractDataVisualizer.HasVisualizer(m_ManagedObject.type.name)) 86 | { 87 | m_DataVisualizer = AbstractDataVisualizer.CreateVisualizer(m_ManagedObject.type.name); 88 | m_DataVisualizer.Initialize(snapshot, new MemoryReader(snapshot), m_ManagedObject.address, m_ManagedObject.type.packed); 89 | } 90 | 91 | m_HexView.Inspect(snapshot, managedObject.address, (ulong)managedObject.size); 92 | } 93 | 94 | public void Inspect(RichManagedType managedType) 95 | { 96 | m_ManagedObject = RichManagedObject.invalid; 97 | m_ManagedType = managedType; 98 | m_PropertyGrid.InspectStaticType(snapshot, m_ManagedType.packed); 99 | m_HexView.Inspect(snapshot, 0, new ArraySegment64(managedType.packed.staticFieldBytes, 0, (ulong)managedType.packed.staticFieldBytes.LongLength)); 100 | 101 | m_DataVisualizer = null; 102 | } 103 | 104 | public void Clear() 105 | { 106 | m_ManagedObject = RichManagedObject.invalid; 107 | m_ManagedType = RichManagedType.invalid; 108 | m_PropertyGrid.Clear(); 109 | m_HexView.Clear(); 110 | m_DataVisualizer = null; 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/PropertyGridView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d1f293f0f7a40940bd32b8526448110 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/ReferenceTypePropertyGridItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor.IMGUI.Controls; 9 | using UnityEditor; 10 | 11 | namespace HeapExplorer 12 | { 13 | public class ReferenceTypePropertyGridItem : PropertyGridItem 14 | { 15 | public PackedManagedField field; 16 | ulong m_Pointer; 17 | 18 | public ReferenceTypePropertyGridItem(PropertyGridControl owner, PackedMemorySnapshot snapshot, System.UInt64 address, AbstractMemoryReader memoryReader) 19 | : base(owner, snapshot, address, memoryReader) 20 | { 21 | } 22 | 23 | protected override void OnInitialize() 24 | { 25 | m_Pointer = m_MemoryReader.ReadPointer(address); 26 | 27 | // If it's a pointer, read the actual object type from the object in memory 28 | // and do not rely on the field type. The reason for this is that the field type 29 | // could be just the base-type or an interface, but the want to display the actual object type instead- 30 | var type = m_Snapshot.managedTypes[field.managedTypesArrayIndex]; 31 | if (type.isPointer && m_Pointer != 0) 32 | { 33 | var i = m_Snapshot.FindManagedObjectTypeOfAddress(m_Pointer); 34 | if (i != -1) 35 | type = m_Snapshot.managedTypes[i]; 36 | } 37 | 38 | base.type = type; 39 | displayName = field.name; 40 | displayType = type.name; 41 | displayValue = m_MemoryReader.ReadFieldValueAsString(address, type); 42 | isExpandable = false;// m_pointer > 0 && PackedManageTypeUtility.HasTypeOrBaseAnyInstanceField(m_snapshot, type); 43 | enabled = m_Pointer > 0; 44 | icon = HeEditorStyles.GetTypeImage(m_Snapshot, type); 45 | 46 | if (field.isStatic) 47 | { 48 | displayType = "static " + displayType; 49 | 50 | //PackedManagedType firstType; 51 | //if (PackedManageTypeUtility.HasTypeOrBaseAnyStaticField(m_snapshot, type, out firstType)) 52 | // allowExpand = m_pointer > 0 && firstType.managedTypeArrayIndex != type.managedTypeArrayIndex; 53 | } 54 | //else 55 | //{ 56 | // // HashString has a HashString static field (HashString.Empty) 57 | // // The following line makes sure that we cannot infinitely expand the same type 58 | // PackedManagedType firstType; 59 | // if (PackedManageTypeUtility.HasTypeOrBaseAnyInstanceField(m_snapshot, type, out firstType)) 60 | // allowExpand = m_pointer > 0 && firstType.managedTypeArrayIndex != type.managedTypeArrayIndex; 61 | //} 62 | 63 | // HashString has a HashString static field (HashString.Empty) 64 | // The following line makes sure that we cannot infinitely expand the same type 65 | PackedManagedType firstType; 66 | if (PackedManagedTypeUtility.HasTypeOrBaseAnyInstanceField(m_Snapshot, type, out firstType)) 67 | isExpandable = m_Pointer > 0 && firstType.managedTypesArrayIndex != type.managedTypesArrayIndex; 68 | } 69 | 70 | protected override void OnBuildChildren(System.Action add) 71 | { 72 | var args = new BuildChildrenArgs 73 | { 74 | parent = this, 75 | type = type, 76 | address = m_Pointer, 77 | memoryReader = new MemoryReader(m_Snapshot), 78 | }; 79 | add(args); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/ReferenceTypePropertyGridItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc3b7bfe8d730b44d85bd5f70589516c 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/ValueTypePropertyGridItem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor.IMGUI.Controls; 9 | using UnityEditor; 10 | 11 | namespace HeapExplorer 12 | { 13 | public class ValueTypePropertyGridItem : PropertyGridItem 14 | { 15 | public PackedManagedField field; 16 | 17 | public ValueTypePropertyGridItem(PropertyGridControl owner, PackedMemorySnapshot snapshot, System.UInt64 address, AbstractMemoryReader memoryReader) 18 | : base(owner, snapshot, address, memoryReader) 19 | { 20 | } 21 | 22 | protected override void OnInitialize() 23 | { 24 | type = m_Snapshot.managedTypes[field.managedTypesArrayIndex]; 25 | displayName = field.name; 26 | displayType = type.name; 27 | displayValue = m_MemoryReader.ReadFieldValueAsString(address, type); 28 | isExpandable = false; 29 | 30 | if (field.isStatic) 31 | { 32 | displayType = "static " + displayType; 33 | 34 | //PackedManagedType firstType; 35 | //if (PackedManageTypeUtility.HasTypeOrBaseAnyStaticField(m_snapshot, m_Type, out firstType)) 36 | // allowExpand = firstType.managedTypeArrayIndex != m_Type.managedTypeArrayIndex; 37 | } 38 | //else 39 | //{ 40 | // // HashString has a HashString static field (HashString.Empty) 41 | // // The following line makes sure that we cannot infinitely expand the same type 42 | // PackedManagedType firstType; 43 | // if (PackedManageTypeUtility.HasTypeOrBaseAnyInstanceField(m_snapshot, m_Type, out firstType)) 44 | // allowExpand = firstType.managedTypeArrayIndex != m_Type.managedTypeArrayIndex; 45 | //} 46 | 47 | // HashString has a HashString static field (HashString.Empty) 48 | // The following line makes sure that we cannot infinitely expand the same type 49 | PackedManagedType firstType; 50 | if (PackedManagedTypeUtility.HasTypeOrBaseAnyInstanceField(m_Snapshot, type, out firstType)) 51 | isExpandable = firstType.managedTypesArrayIndex != type.managedTypesArrayIndex; 52 | 53 | icon = HeEditorStyles.GetTypeImage(m_Snapshot, type); 54 | } 55 | 56 | protected override void OnBuildChildren(System.Action add) 57 | { 58 | var args = new BuildChildrenArgs(); 59 | args.parent = this; 60 | args.type = m_Snapshot.managedTypes[field.managedTypesArrayIndex]; 61 | args.address = address - (ulong)m_Snapshot.virtualMachineInformation.objectHeaderSize; 62 | args.memoryReader = field.isStatic ? (AbstractMemoryReader)(new StaticMemoryReader(m_Snapshot, args.type.staticFieldBytes)) : (AbstractMemoryReader)(new MemoryReader(m_Snapshot));// m_memoryReader; 63 | add(args); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Editor/Scripts/PropertyGrid/ValueTypePropertyGridItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 224397e6e11332247b98e1aa711e92cb 3 | timeCreated: 1527319063 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/RichTypes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa63f8b971f61a84d88dc7f71d3db924 3 | folderAsset: yes 4 | timeCreated: 1527319054 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/RichTypes/RichGCHandle.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | 9 | namespace HeapExplorer 10 | { 11 | public struct RichGCHandle 12 | { 13 | PackedMemorySnapshot m_Snapshot; 14 | int m_GCHandleArrayIndex; 15 | 16 | public RichGCHandle(PackedMemorySnapshot snapshot, int gcHandlesArrayIndex) 17 | : this() 18 | { 19 | m_Snapshot = snapshot; 20 | m_GCHandleArrayIndex = gcHandlesArrayIndex; 21 | } 22 | 23 | public PackedGCHandle packed 24 | { 25 | get 26 | { 27 | if (!isValid) 28 | return new PackedGCHandle() { gcHandlesArrayIndex = -1, managedObjectsArrayIndex = -1 }; 29 | 30 | return m_Snapshot.gcHandles[m_GCHandleArrayIndex]; 31 | } 32 | } 33 | 34 | public PackedMemorySnapshot snapshot 35 | { 36 | get 37 | { 38 | return m_Snapshot; 39 | } 40 | } 41 | 42 | public bool isValid 43 | { 44 | get 45 | { 46 | var value = m_Snapshot != null && m_GCHandleArrayIndex >= 0 && m_GCHandleArrayIndex < m_Snapshot.gcHandles.Length; 47 | return value; 48 | } 49 | } 50 | 51 | public RichManagedObject managedObject 52 | { 53 | get 54 | { 55 | if (isValid) 56 | { 57 | var gcHandle = m_Snapshot.gcHandles[m_GCHandleArrayIndex]; 58 | if (gcHandle.managedObjectsArrayIndex >= 0) 59 | return new RichManagedObject(m_Snapshot, gcHandle.managedObjectsArrayIndex); 60 | } 61 | 62 | return RichManagedObject.invalid; 63 | } 64 | } 65 | 66 | public RichNativeObject nativeObject 67 | { 68 | get 69 | { 70 | return managedObject.nativeObject; 71 | } 72 | } 73 | 74 | public System.UInt64 managedObjectAddress 75 | { 76 | get 77 | { 78 | if (!isValid) 79 | return 0; 80 | 81 | return m_Snapshot.gcHandles[m_GCHandleArrayIndex].target; 82 | } 83 | } 84 | 85 | public int size 86 | { 87 | get 88 | { 89 | return m_Snapshot.virtualMachineInformation.pointerSize; 90 | } 91 | } 92 | 93 | public static readonly RichGCHandle invalid = new RichGCHandle() 94 | { 95 | m_Snapshot = null, 96 | m_GCHandleArrayIndex = -1 97 | }; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /Editor/Scripts/RichTypes/RichGCHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 096268539bc08a449b76b2a4e27a22f6 3 | timeCreated: 1527319062 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/RichTypes/RichManagedObject.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | 9 | namespace HeapExplorer 10 | { 11 | public struct RichManagedObject 12 | { 13 | public RichManagedObject(PackedMemorySnapshot snapshot, int managedObjectsArrayIndex) 14 | : this() 15 | { 16 | m_Snapshot = snapshot; 17 | m_ManagedObjectArrayIndex = managedObjectsArrayIndex; 18 | } 19 | 20 | public PackedManagedObject packed 21 | { 22 | get 23 | { 24 | if (!isValid) 25 | return PackedManagedObject.New(); 26 | 27 | return m_Snapshot.managedObjects[m_ManagedObjectArrayIndex]; 28 | } 29 | } 30 | 31 | public PackedMemorySnapshot snapshot 32 | { 33 | get 34 | { 35 | return m_Snapshot; 36 | } 37 | } 38 | 39 | public bool isValid 40 | { 41 | get 42 | { 43 | var value = m_Snapshot != null && m_ManagedObjectArrayIndex >= 0 && m_ManagedObjectArrayIndex < m_Snapshot.managedObjects.Length; 44 | return value; 45 | } 46 | } 47 | 48 | public System.Int32 arrayIndex 49 | { 50 | get 51 | { 52 | return m_ManagedObjectArrayIndex; 53 | } 54 | } 55 | 56 | public System.UInt64 address 57 | { 58 | get 59 | { 60 | if (!isValid) 61 | return 0; 62 | 63 | var mo = m_Snapshot.managedObjects[m_ManagedObjectArrayIndex]; 64 | return mo.address; 65 | } 66 | } 67 | 68 | public System.Int32 size 69 | { 70 | get 71 | { 72 | if (isValid) 73 | { 74 | var mo = m_Snapshot.managedObjects[m_ManagedObjectArrayIndex]; 75 | return mo.size; 76 | } 77 | 78 | return 0; 79 | } 80 | } 81 | 82 | public RichManagedType type 83 | { 84 | get 85 | { 86 | if (isValid) 87 | { 88 | var mo = m_Snapshot.managedObjects[m_ManagedObjectArrayIndex]; 89 | return new RichManagedType(m_Snapshot, mo.managedTypesArrayIndex); 90 | } 91 | 92 | return RichManagedType.invalid; 93 | } 94 | } 95 | 96 | public RichGCHandle gcHandle 97 | { 98 | get 99 | { 100 | if (isValid) 101 | { 102 | var mo = m_Snapshot.managedObjects[m_ManagedObjectArrayIndex]; 103 | if (mo.gcHandlesArrayIndex >= 0) 104 | return new RichGCHandle(m_Snapshot, mo.gcHandlesArrayIndex); 105 | } 106 | 107 | return RichGCHandle.invalid; 108 | } 109 | } 110 | 111 | public RichNativeObject nativeObject 112 | { 113 | get 114 | { 115 | if (isValid) 116 | { 117 | var mo = m_Snapshot.managedObjects[m_ManagedObjectArrayIndex]; 118 | if (mo.nativeObjectsArrayIndex >= 0) 119 | return new RichNativeObject(m_Snapshot, mo.nativeObjectsArrayIndex); 120 | } 121 | 122 | return RichNativeObject.invalid; 123 | } 124 | } 125 | 126 | public override string ToString() 127 | { 128 | return string.Format("Valid: {0}, Addr: {1:X}, Type: {2}", isValid, address, type.name); 129 | } 130 | 131 | public static readonly RichManagedObject invalid = new RichManagedObject() 132 | { 133 | m_Snapshot = null, 134 | m_ManagedObjectArrayIndex = -1 135 | }; 136 | 137 | PackedMemorySnapshot m_Snapshot; 138 | int m_ManagedObjectArrayIndex; 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /Editor/Scripts/RichTypes/RichManagedObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 48d8b893f6b1d5c47aa767e1af697c03 3 | timeCreated: 1527319064 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/RichTypes/RichManagedType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | using System; 10 | 11 | namespace HeapExplorer 12 | { 13 | /// 14 | /// The RichManagedType provides high-level access to a managed type in a memory snapshot. 15 | /// 16 | public struct RichManagedType 17 | { 18 | public RichManagedType(PackedMemorySnapshot snapshot, int managedTypesArrayIndex) 19 | : this() 20 | { 21 | m_Snapshot = snapshot; 22 | m_ManagedTypesArrayIndex = managedTypesArrayIndex; 23 | } 24 | 25 | /// 26 | /// Gets the underlaying low-level type. 27 | /// 28 | public PackedManagedType packed 29 | { 30 | get 31 | { 32 | if (!isValid) 33 | return new PackedManagedType() { baseOrElementTypeIndex = -1, managedTypesArrayIndex = -1 }; 34 | 35 | return m_Snapshot.managedTypes[m_ManagedTypesArrayIndex]; 36 | } 37 | } 38 | 39 | public PackedMemorySnapshot snapshot 40 | { 41 | get 42 | { 43 | return m_Snapshot; 44 | } 45 | } 46 | 47 | /// 48 | /// Gets whether the RichManagedType instance is valid. 49 | /// 50 | public bool isValid 51 | { 52 | get 53 | { 54 | return m_Snapshot != null && m_ManagedTypesArrayIndex >= 0 && m_ManagedTypesArrayIndex < m_Snapshot.managedTypes.Length; 55 | } 56 | } 57 | 58 | /// 59 | /// Gets the name of the type. 60 | /// 61 | public string name 62 | { 63 | get 64 | { 65 | if (!isValid) 66 | return ""; 67 | 68 | return m_Snapshot.managedTypes[m_ManagedTypesArrayIndex].name; 69 | } 70 | } 71 | 72 | /// 73 | /// Gets the name of the assembly where this type is stored in. 74 | /// 75 | public string assemblyName 76 | { 77 | get 78 | { 79 | if (!isValid) 80 | return ""; 81 | 82 | return m_Snapshot.managedTypes[m_ManagedTypesArrayIndex].assembly; 83 | } 84 | } 85 | 86 | public bool FindField(string name, out PackedManagedField packedManagedField) 87 | { 88 | packedManagedField = new PackedManagedField(); 89 | if (!isValid) 90 | return false; 91 | 92 | var guard = 0; 93 | var me = m_Snapshot.managedTypes[m_ManagedTypesArrayIndex]; 94 | while (me.managedTypesArrayIndex != -1) 95 | { 96 | for (var n=0; n 64) 106 | break; 107 | 108 | if (me.baseOrElementTypeIndex == -1) 109 | break; 110 | 111 | me = m_Snapshot.managedTypes[me.baseOrElementTypeIndex]; 112 | } 113 | return false; 114 | } 115 | 116 | /// 117 | /// Gets whether this native type is a subclass of the specified type 't'. 118 | /// 119 | public bool IsSubclassOf(PackedManagedType t) 120 | { 121 | if (!isValid || t.managedTypesArrayIndex == -1) 122 | return false; 123 | 124 | var me = m_Snapshot.managedTypes[m_ManagedTypesArrayIndex]; 125 | if (me.managedTypesArrayIndex == t.managedTypesArrayIndex) 126 | return true; 127 | 128 | var guard = 0; 129 | while (me.baseOrElementTypeIndex != -1) 130 | { 131 | if (++guard > 64) 132 | break; // no inheritance should have more depths than this 133 | 134 | if (me.baseOrElementTypeIndex == t.managedTypesArrayIndex) 135 | return true; 136 | 137 | me = m_Snapshot.managedTypes[me.baseOrElementTypeIndex]; 138 | } 139 | 140 | return false; 141 | } 142 | 143 | /// 144 | /// Gets an invalid managed type instance. 145 | /// 146 | public static readonly RichManagedType invalid = new RichManagedType() 147 | { 148 | m_Snapshot = null, 149 | m_ManagedTypesArrayIndex = -1 150 | }; 151 | 152 | PackedMemorySnapshot m_Snapshot; 153 | int m_ManagedTypesArrayIndex; 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /Editor/Scripts/RichTypes/RichManagedType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9c1fc597e300b0c48b83767d2c4b25aa 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/RichTypes/RichNativeObject.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | 9 | namespace HeapExplorer 10 | { 11 | public struct RichNativeObject 12 | { 13 | public RichNativeObject(PackedMemorySnapshot snapshot, int nativeObjectsArrayIndex) 14 | : this() 15 | { 16 | m_Snapshot = snapshot; 17 | m_NativeObjectArrayIndex = nativeObjectsArrayIndex; 18 | } 19 | 20 | public PackedNativeUnityEngineObject packed 21 | { 22 | get 23 | { 24 | if (!isValid) 25 | return new PackedNativeUnityEngineObject() { nativeObjectsArrayIndex = -1, nativeTypesArrayIndex = -1, managedObjectsArrayIndex = -1 }; 26 | 27 | return m_Snapshot.nativeObjects[m_NativeObjectArrayIndex]; 28 | } 29 | } 30 | 31 | public PackedMemorySnapshot snapshot 32 | { 33 | get 34 | { 35 | return m_Snapshot; 36 | } 37 | } 38 | 39 | public bool isValid 40 | { 41 | get 42 | { 43 | return m_Snapshot != null && m_NativeObjectArrayIndex >= 0 && m_NativeObjectArrayIndex < m_Snapshot.nativeObjects.Length; 44 | } 45 | } 46 | 47 | public RichNativeType type 48 | { 49 | get 50 | { 51 | if (!isValid) 52 | return RichNativeType.invalid; 53 | 54 | var obj = m_Snapshot.nativeObjects[m_NativeObjectArrayIndex]; 55 | return new RichNativeType(m_Snapshot, obj.nativeTypesArrayIndex); 56 | } 57 | } 58 | 59 | public RichManagedObject managedObject 60 | { 61 | get 62 | { 63 | if (!isValid) 64 | return RichManagedObject.invalid; 65 | 66 | var native = m_Snapshot.nativeObjects[m_NativeObjectArrayIndex]; 67 | if (native.managedObjectsArrayIndex < 0) 68 | return RichManagedObject.invalid; 69 | 70 | return new RichManagedObject(m_Snapshot, native.managedObjectsArrayIndex); 71 | } 72 | } 73 | 74 | public RichGCHandle gcHandle 75 | { 76 | get 77 | { 78 | return managedObject.gcHandle; 79 | } 80 | } 81 | 82 | public string name 83 | { 84 | get 85 | { 86 | if (!isValid) 87 | return ""; 88 | 89 | return m_Snapshot.nativeObjects[m_NativeObjectArrayIndex].name; 90 | } 91 | } 92 | 93 | public System.UInt64 address 94 | { 95 | get 96 | { 97 | if (!isValid) 98 | return 0; 99 | 100 | return (System.UInt64)m_Snapshot.nativeObjects[m_NativeObjectArrayIndex].nativeObjectAddress; 101 | } 102 | } 103 | 104 | public HideFlags hideFlags 105 | { 106 | get 107 | { 108 | if (!isValid) 109 | return HideFlags.None; 110 | 111 | return m_Snapshot.nativeObjects[m_NativeObjectArrayIndex].hideFlags; 112 | } 113 | } 114 | 115 | public int instanceId 116 | { 117 | get 118 | { 119 | if (!isValid) 120 | return 0; 121 | 122 | return m_Snapshot.nativeObjects[m_NativeObjectArrayIndex].instanceId; 123 | } 124 | } 125 | 126 | public bool isDontDestroyOnLoad 127 | { 128 | get 129 | { 130 | if (!isValid) 131 | return true; 132 | 133 | return m_Snapshot.nativeObjects[m_NativeObjectArrayIndex].isDontDestroyOnLoad; 134 | } 135 | } 136 | 137 | public bool isManager 138 | { 139 | get 140 | { 141 | if (!isValid) 142 | return false; 143 | 144 | return m_Snapshot.nativeObjects[m_NativeObjectArrayIndex].isManager; 145 | } 146 | } 147 | 148 | public bool isPersistent 149 | { 150 | get 151 | { 152 | if (!isValid) 153 | return false; 154 | 155 | return m_Snapshot.nativeObjects[m_NativeObjectArrayIndex].isPersistent; 156 | } 157 | } 158 | 159 | public int size 160 | { 161 | get 162 | { 163 | if (!isValid) 164 | return 0; 165 | 166 | return m_Snapshot.nativeObjects[m_NativeObjectArrayIndex].size; 167 | } 168 | } 169 | 170 | public void GetConnections(List references, List referencedBy) 171 | { 172 | if (!isValid) 173 | return; 174 | 175 | m_Snapshot.GetConnections(packed, references, referencedBy); 176 | } 177 | 178 | public void GetConnectionsCount(out int referencesCount, out int referencedByCount) 179 | { 180 | if (!isValid) 181 | { 182 | referencesCount = 0; 183 | referencedByCount = 0; 184 | return; 185 | } 186 | 187 | m_Snapshot.GetConnectionsCount(PackedConnection.Kind.Native, m_NativeObjectArrayIndex, out referencesCount, out referencedByCount); 188 | } 189 | 190 | public static readonly RichNativeObject invalid = new RichNativeObject() 191 | { 192 | m_Snapshot = null, 193 | m_NativeObjectArrayIndex = -1 194 | }; 195 | 196 | PackedMemorySnapshot m_Snapshot; 197 | int m_NativeObjectArrayIndex; 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /Editor/Scripts/RichTypes/RichNativeObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c0cf0a2f066bb0e468af69e1d56e2d08 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/RichTypes/RichNativeType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | 10 | namespace HeapExplorer 11 | { 12 | public struct RichNativeType 13 | { 14 | public RichNativeType(PackedMemorySnapshot snapshot, int nativeTypesArrayIndex) 15 | : this() 16 | { 17 | m_Snapshot = snapshot; 18 | m_NativeTypesArrayIndex = nativeTypesArrayIndex; 19 | } 20 | 21 | public PackedNativeType packed 22 | { 23 | get 24 | { 25 | if (!isValid) 26 | return new PackedNativeType() { nativeTypeArrayIndex = -1, nativeBaseTypeArrayIndex = -1, name = "" }; 27 | 28 | return m_Snapshot.nativeTypes[m_NativeTypesArrayIndex]; 29 | } 30 | } 31 | 32 | public PackedMemorySnapshot snapshot 33 | { 34 | get 35 | { 36 | return m_Snapshot; 37 | } 38 | } 39 | 40 | public bool isValid 41 | { 42 | get 43 | { 44 | return m_Snapshot != null && m_NativeTypesArrayIndex >= 0 && m_NativeTypesArrayIndex < m_Snapshot.nativeTypes.Length; 45 | } 46 | } 47 | 48 | public string name 49 | { 50 | get 51 | { 52 | if (!isValid) 53 | return ""; 54 | 55 | var t = m_Snapshot.nativeTypes[m_NativeTypesArrayIndex]; 56 | return t.name; 57 | } 58 | } 59 | 60 | public RichNativeType baseType 61 | { 62 | get 63 | { 64 | if (!isValid) 65 | return RichNativeType.invalid; 66 | 67 | var t = m_Snapshot.nativeTypes[m_NativeTypesArrayIndex]; 68 | if (t.nativeBaseTypeArrayIndex < 0) 69 | return RichNativeType.invalid; 70 | 71 | return new RichNativeType(m_Snapshot, t.nativeBaseTypeArrayIndex); 72 | } 73 | } 74 | 75 | /// 76 | /// Gets whether this native type is a subclass of the specified baseType. 77 | /// 78 | public bool IsSubclassOf(int baseTypeIndex) 79 | { 80 | if (!isValid || baseTypeIndex < 0) 81 | return false; 82 | 83 | return m_Snapshot.IsSubclassOf(m_Snapshot.nativeTypes[m_NativeTypesArrayIndex], baseTypeIndex); 84 | } 85 | 86 | public static readonly RichNativeType invalid = new RichNativeType() 87 | { 88 | m_Snapshot = null, 89 | m_NativeTypesArrayIndex = -1 90 | }; 91 | 92 | PackedMemorySnapshot m_Snapshot; 93 | int m_NativeTypesArrayIndex; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Editor/Scripts/RichTypes/RichNativeType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf68a5f724c1e1942a0fa623c123eeb2 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/RichTypes/RichStaticField.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | 9 | namespace HeapExplorer 10 | { 11 | public struct RichStaticField 12 | { 13 | public RichStaticField(PackedMemorySnapshot snapshot, int staticFieldsArrayIndex) 14 | : this() 15 | { 16 | m_Snapshot = snapshot; 17 | m_ManagedStaticFieldsArrayIndex = staticFieldsArrayIndex; 18 | } 19 | 20 | public PackedManagedStaticField packed 21 | { 22 | get 23 | { 24 | if (!isValid) 25 | { 26 | return new PackedManagedStaticField() 27 | { 28 | managedTypesArrayIndex = -1, 29 | fieldIndex = -1, 30 | staticFieldsArrayIndex = -1, 31 | }; 32 | } 33 | 34 | return m_Snapshot.managedStaticFields[m_ManagedStaticFieldsArrayIndex]; 35 | } 36 | } 37 | 38 | public PackedMemorySnapshot snapshot 39 | { 40 | get 41 | { 42 | return m_Snapshot; 43 | } 44 | } 45 | 46 | public bool isValid 47 | { 48 | get 49 | { 50 | var value = m_Snapshot != null && m_ManagedStaticFieldsArrayIndex >= 0 && m_ManagedStaticFieldsArrayIndex < m_Snapshot.managedStaticFields.Length; 51 | return value; 52 | } 53 | } 54 | 55 | public System.Int32 arrayIndex 56 | { 57 | get 58 | { 59 | return m_ManagedStaticFieldsArrayIndex; 60 | } 61 | } 62 | 63 | public RichManagedType fieldType 64 | { 65 | get 66 | { 67 | if (isValid) 68 | { 69 | var mo = m_Snapshot.managedStaticFields[m_ManagedStaticFieldsArrayIndex]; 70 | 71 | var staticClassType = m_Snapshot.managedTypes[mo.managedTypesArrayIndex]; 72 | var staticField = staticClassType.fields[mo.fieldIndex]; 73 | var staticFieldType = m_Snapshot.managedTypes[staticField.managedTypesArrayIndex]; 74 | 75 | return new RichManagedType(m_Snapshot, staticFieldType.managedTypesArrayIndex); 76 | } 77 | 78 | return RichManagedType.invalid; 79 | } 80 | } 81 | 82 | public RichManagedType classType 83 | { 84 | get 85 | { 86 | if (isValid) 87 | { 88 | var mo = m_Snapshot.managedStaticFields[m_ManagedStaticFieldsArrayIndex]; 89 | return new RichManagedType(m_Snapshot, mo.managedTypesArrayIndex); 90 | } 91 | 92 | return RichManagedType.invalid; 93 | } 94 | } 95 | 96 | public static readonly RichStaticField invalid = new RichStaticField() 97 | { 98 | m_Snapshot = null, 99 | m_ManagedStaticFieldsArrayIndex = -1 100 | }; 101 | 102 | PackedMemorySnapshot m_Snapshot; 103 | int m_ManagedStaticFieldsArrayIndex; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /Editor/Scripts/RichTypes/RichStaticField.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a2715283026e1c4faba942bec54e444 3 | timeCreated: 1527319062 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/RootPathView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b9f2be6edfd80c4caed766b97d7227e 3 | folderAsset: yes 4 | timeCreated: 1527319053 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/RootPathView/RootPathControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 35964e519a364e449a16ef6100c9bdb2 3 | timeCreated: 1527319063 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/RootPathView/RootPathView.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor.IMGUI.Controls; 9 | using UnityEditor; 10 | 11 | namespace HeapExplorer 12 | { 13 | public class RootPathView : HeapExplorerView 14 | { 15 | RootPath m_Selected; 16 | RootPathControl m_RootPathControl; 17 | RootPathUtility m_RootPaths = new RootPathUtility(); 18 | 19 | protected override void OnCreate() 20 | { 21 | base.OnCreate(); 22 | 23 | m_RootPathControl = new RootPathControl(window, GetPrefsKey(() => m_RootPathControl), new TreeViewState()); 24 | m_RootPathControl.onSelectionChange += OnSelectionChange; 25 | } 26 | 27 | protected override void OnHide() 28 | { 29 | base.OnHide(); 30 | 31 | m_RootPathControl.SaveLayout(); 32 | } 33 | 34 | public override void OnGUI() 35 | { 36 | base.OnGUI(); 37 | 38 | using (new EditorGUI.DisabledGroupScope(m_RootPaths.isBusy)) 39 | { 40 | using (new EditorGUILayout.VerticalScope()) 41 | { 42 | using (new EditorGUILayout.HorizontalScope()) 43 | { 44 | EditorGUILayout.LabelField(string.Format("{0} Path(s) to Root", m_RootPaths.count), EditorStyles.boldLabel); 45 | } 46 | 47 | GUILayout.Space(2); 48 | m_RootPathControl.OnGUI(); 49 | 50 | GUILayout.Space(2); 51 | var reason = "No root object selected."; 52 | if (m_Selected != null) 53 | reason = m_Selected.reasonString; 54 | EditorGUI.HelpBox(GUILayoutUtility.GetRect(10, 48, GUILayout.ExpandWidth(true)), reason, MessageType.Info); 55 | } 56 | } 57 | 58 | if (m_RootPaths.isBusy) 59 | { 60 | var r = GUILayoutUtility.GetLastRect(); 61 | r.x = r.center.x - 100; 62 | r.width = 200; 63 | r.y = r.center.y - 70; 64 | r.height = 50; 65 | GUI.Label(r, string.Format("Finding root paths, please wait.\n{0} objects scanned", m_RootPaths.scanned), HeEditorStyles.centeredWordWrapLabel); 66 | 67 | r = GUILayoutUtility.GetLastRect(); 68 | r.x = r.center.x - 60; 69 | r.width = 120; 70 | r.y = r.center.y - 20; 71 | r.height = 24; 72 | 73 | if (GUI.Button(r, "Cancel")) 74 | { 75 | m_RootPaths.Abort(); 76 | } 77 | } 78 | } 79 | 80 | public void Inspect(PackedNativeUnityEngineObject item) 81 | { 82 | m_Selected = null; 83 | ScheduleJob(new ObjectProxy(snapshot, item)); 84 | } 85 | 86 | public void Inspect(PackedManagedObject item) 87 | { 88 | m_Selected = null; 89 | ScheduleJob(new ObjectProxy(snapshot, item)); 90 | } 91 | 92 | public void Inspect(PackedManagedStaticField item) 93 | { 94 | m_Selected = null; 95 | ScheduleJob(new ObjectProxy(snapshot, item)); 96 | } 97 | 98 | public void Inspect(PackedGCHandle item) 99 | { 100 | m_Selected = null; 101 | ScheduleJob(new ObjectProxy(snapshot, item)); 102 | } 103 | 104 | public void Clear() 105 | { 106 | m_RootPathControl.SetTree(null); 107 | m_Selected = null; 108 | m_RootPaths.Abort(); 109 | m_RootPaths = new RootPathUtility(); 110 | ScheduleJob(new RootPathJob() { control = m_RootPathControl }); 111 | } 112 | 113 | void ScheduleJob(ObjectProxy objectProxy) 114 | { 115 | Clear(); 116 | 117 | var job = new RootPathJob 118 | { 119 | snapshot = snapshot, 120 | objectProxy = objectProxy, 121 | control = m_RootPathControl, 122 | paths = m_RootPaths 123 | }; 124 | 125 | ScheduleJob(job); 126 | } 127 | 128 | void OnSelectionChange(RootPath path) 129 | { 130 | m_Selected = path; 131 | } 132 | 133 | class RootPathJob : AbstractThreadJob 134 | { 135 | public ObjectProxy objectProxy; 136 | public RootPathControl control; 137 | public PackedMemorySnapshot snapshot; 138 | 139 | // in/out 140 | public RootPathUtility paths; 141 | 142 | // Output 143 | public TreeViewItem tree; 144 | 145 | public override void ThreadFunc() 146 | { 147 | if (objectProxy != null) 148 | paths.Find(objectProxy); 149 | 150 | tree = control.BuildTree(snapshot, paths); 151 | } 152 | 153 | public override void IntegrateFunc() 154 | { 155 | control.SetTree(tree); 156 | } 157 | } 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /Editor/Scripts/RootPathView/RootPathView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3733b774a27787141bc59214c2a81745 3 | timeCreated: 1527319063 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/SearchTextParser.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3bb5c8f0ddb8a1f42909a9803b2a5545 3 | timeCreated: 1527319063 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/StaticFieldsView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e58b168f4f4ffdd4c8bbed6c52f738ac 3 | folderAsset: yes 4 | timeCreated: 1527319054 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/StaticFieldsView/StaticFieldsControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe0cd4014bab24f48a61d00b2d103db8 3 | timeCreated: 1527319067 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/StaticFieldsView/StaticFieldsView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9487c5f8c582c5444a1364d386904447 3 | timeCreated: 1527319065 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Scripts/TestVariables.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 32e625d82cbbc2442807f5d9b12ddde8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Scripts/WelcomeView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bceefa2f92842374b8e536b8fd7faa35 3 | folderAsset: yes 4 | timeCreated: 1527319053 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Scripts/WelcomeView/WelcomeView.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md 3 | // https://github.com/pschraut/UnityHeapExplorer/ 4 | // 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | using UnityEditor; 9 | 10 | namespace HeapExplorer 11 | { 12 | public class WelcomeView : HeapExplorerView 13 | { 14 | Vector2 m_MruScrollPosition; 15 | 16 | [InitializeOnLoadMethod] 17 | static void Register() 18 | { 19 | HeapExplorerWindow.Register(); 20 | } 21 | 22 | public override void Awake() 23 | { 24 | base.Awake(); 25 | 26 | titleContent = new GUIContent("Start Page", ""); 27 | viewMenuOrder = -1; 28 | } 29 | 30 | protected override void OnShow() 31 | { 32 | base.OnShow(); 33 | 34 | HeMruFiles.Load(); 35 | } 36 | 37 | public override void OnGUI() 38 | { 39 | base.OnGUI(); 40 | 41 | GUILayout.Space(4); 42 | GUILayout.Label(string.Format("{0} {1} for Unity", HeGlobals.k_Title, HeGlobals.k_Version), HeEditorStyles.heading1); 43 | GUILayout.Label("Created by Peter Schraut (www.console-dev.de)"); 44 | GUILayout.Space(16); 45 | 46 | using (new EditorGUILayout.HorizontalScope()) 47 | { 48 | using (new EditorGUILayout.VerticalScope()) 49 | { 50 | DrawMRU(); 51 | GUILayout.Space(8); 52 | 53 | DrawHelp(); 54 | GUILayout.Space(8); 55 | 56 | GUILayout.FlexibleSpace(); 57 | } 58 | 59 | GUILayout.FlexibleSpace(); 60 | } 61 | } 62 | 63 | void DrawHelp() 64 | { 65 | using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox)) 66 | { 67 | GUILayout.Label("Help", HeEditorStyles.heading2); 68 | GUILayout.Space(8); 69 | 70 | GUILayout.Label("Documentation", EditorStyles.boldLabel); 71 | if (HeEditorGUILayout.LinkButton(new GUIContent(HeGlobals.k_DocuUrl))) Application.OpenURL(HeGlobals.k_DocuUrl); 72 | GUILayout.Space(8); 73 | 74 | GUILayout.Label("Changelog", EditorStyles.boldLabel); 75 | if (HeEditorGUILayout.LinkButton(new GUIContent(HeGlobals.k_ChangelogUrl))) Application.OpenURL(HeGlobals.k_ChangelogUrl); 76 | GUILayout.Space(8); 77 | 78 | GUILayout.Label("Feedback and bug-reports", EditorStyles.boldLabel); 79 | if (HeEditorGUILayout.LinkButton(new GUIContent(HeGlobals.k_ForumUrl))) Application.OpenURL(HeGlobals.k_ForumUrl); 80 | GUILayout.Space(8); 81 | 82 | GUILayout.Label("Unity Package and C# Source Code", EditorStyles.boldLabel); 83 | if (HeEditorGUILayout.LinkButton(new GUIContent(HeGlobals.k_RepositoryUrl))) Application.OpenURL(HeGlobals.k_RepositoryUrl); 84 | GUILayout.Space(8); 85 | 86 | var memprofLink = "https://forum.unity.com/threads/new-memory-profiler-preview-package-available-for-unity-2018-3-and-newer-versions.597271/"; 87 | GUILayout.Label("Unity Memory Profiler", EditorStyles.boldLabel); 88 | GUILayout.Label("Unity Technologies presented during Unite 2018 that they were working on a new Memory Profiler, which was made available shortly after. Their new Memory Profiler will make Heap Explorer obsolete eventually, if it didn't already. Don't miss to check out their Memory Profiler, it must be far superior to Heap Explorer by now.", EditorStyles.wordWrappedLabel); 89 | if (HeEditorGUILayout.LinkButton(new GUIContent(memprofLink))) Application.OpenURL(memprofLink); 90 | GUILayout.Space(8); 91 | } 92 | } 93 | 94 | void DrawCapture() 95 | { 96 | using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox)) 97 | { 98 | GUILayout.Label("Capture", HeEditorStyles.heading2); 99 | 100 | GUILayout.Label( 101 | @"How to capture a memory snaphot? 102 | 103 | • Close all Unity Editor instances but one. 104 | • Run your 'Development Build'. 105 | • Use the 'Capture' drop-down in Heap Explorer toolbar to capture a memory snapshot. 106 | 107 | The 'Capture' drop-down shows the connected application, from where a memory snapshot is captured. 108 | You can switch the connected application in Unity's Profiler (Window > Profiler). 109 | "); 110 | } 111 | } 112 | 113 | void DrawMRU() 114 | { 115 | if (HeMruFiles.count == 0) 116 | return; 117 | 118 | using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox)) 119 | { 120 | GUILayout.Label("Recent", HeEditorStyles.heading2); 121 | 122 | using (var scrollView = new EditorGUILayout.ScrollViewScope(m_MruScrollPosition)) 123 | { 124 | m_MruScrollPosition = scrollView.scrollPosition; 125 | 126 | for (int n = 0, nend = HeMruFiles.count; n < nend; ++n) 127 | { 128 | using (new GUILayout.HorizontalScope()) 129 | { 130 | var path = HeMruFiles.GetPath(n); 131 | 132 | GUILayout.Label(string.Format("{0,2:##}", n + 1), GUILayout.Width(20)); 133 | 134 | if (GUILayout.Button(new GUIContent(HeEditorStyles.deleteImage, "Remove entry from list"), HeEditorStyles.iconStyle, GUILayout.Width(16), GUILayout.Height(16))) 135 | { 136 | HeMruFiles.RemovePath(path); 137 | break; 138 | } 139 | 140 | if (GUILayout.Button(new GUIContent(string.Format("{0}", path)), HeEditorStyles.hyperlink)) 141 | { 142 | window.LoadFromFile(path); 143 | } 144 | 145 | if (Event.current.type == EventType.Repaint) 146 | EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link); 147 | } 148 | } 149 | } 150 | } 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /Editor/Scripts/WelcomeView/WelcomeView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ed35fd038914a99458091fca42cb997a 3 | timeCreated: 1527319066 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Editor/Unity.HeapExplorer.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Unity.HeapExplorer.Editor", 3 | "references": [], 4 | "includePlatforms": [ 5 | "Editor" 6 | ], 7 | "excludePlatforms": [], 8 | "allowUnsafeCode": false, 9 | "overrideReferences": false, 10 | "precompiledReferences": [], 11 | "autoReferenced": true, 12 | "defineConstraints": [], 13 | "versionDefines": [], 14 | "noEngineReferences": false 15 | } -------------------------------------------------------------------------------- /Editor/Unity.HeapExplorer.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f45de16929cc3034db2b2cc01b230fc6 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2024 Peter Schraut (http://www.console-dev.de) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3daed33e3b47aa74ab53143022978834 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a79780e413f1d9f4ab523a324d0026ee 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Tests.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 847299db8c8c6aa40a7d86fb9bd84b92 3 | folderAsset: yes 4 | timeCreated: 1522684699 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Tests/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a82098781b15b14db230aa1f9928069 3 | folderAsset: yes 4 | timeCreated: 1522684708 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Tests/Editor/Test_Editor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e864a7b08b5a7d94e82dafbb0bafad54 3 | timeCreated: 1517232758 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Tests/Editor/Unity.HeapExplorer.Editor.Tests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Unity.HeapExplorer.Editor.Tests", 3 | "references": [ 4 | "GUID:f45de16929cc3034db2b2cc01b230fc6", 5 | "GUID:0acc523941302664db1f4e527237feb3", 6 | "GUID:27619889b8ba8c24980f49ee34dbb44a" 7 | ], 8 | "includePlatforms": [ 9 | "Editor" 10 | ], 11 | "excludePlatforms": [], 12 | "allowUnsafeCode": false, 13 | "overrideReferences": false, 14 | "precompiledReferences": [], 15 | "autoReferenced": true, 16 | "defineConstraints": [], 17 | "versionDefines": [], 18 | "noEngineReferences": false 19 | } -------------------------------------------------------------------------------- /Tests/Editor/Unity.HeapExplorer.Editor.Tests.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd5bc7886301e3544ad3985914870b04 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.oddworm.heapexplorer", 3 | "version": "4.3.0", 4 | "displayName": "Heap Explorer", 5 | "description": "Heap Explorer is a Memory Profiler, Debugger and Analyzer for Unity. You can open it from the main menu 'Window > Analysis > Heap Explorer'.", 6 | "documentationUrl": "https://github.com/pschraut/UnityHeapExplorer", 7 | "unity": "2019.3", 8 | "dependencies": { 9 | }, 10 | "keywords": [ 11 | "profiler", 12 | "memory", 13 | "editor" 14 | ], 15 | "author": { 16 | "name": "Peter Schraut", 17 | "url": "http://console-dev.de" 18 | }, 19 | "repository": { 20 | "type": "git", 21 | "url": "https://github.com/pschraut/UnityHeapExplorer.git" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9c36c9ee26c27c7428cfd81aa86a48f2 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------