├── .allstar └── binary_artifacts.yaml ├── CONTRIBUTING.md ├── CONTRIBUTING.md.meta ├── Editor.meta ├── Editor ├── Google.Android.PerformanceTuner.Editor.asmdef ├── Google.Android.PerformanceTuner.Editor.asmdef.meta ├── Protoc.meta ├── Protoc │ ├── linux64.meta │ ├── linux64 │ │ ├── protoc │ │ └── protoc.meta │ ├── mac.meta │ ├── mac │ │ ├── protoc │ │ └── protoc.meta │ ├── win32.meta │ └── win32 │ │ ├── protoc.exe │ │ └── protoc.exe.meta ├── Resources.meta ├── Resources │ ├── baseline_info_outline.png │ ├── baseline_info_outline.png.meta │ ├── ic_add.png │ ├── ic_add.png.meta │ ├── ic_done.png │ ├── ic_done.png.meta │ ├── ic_error_outline.png │ ├── ic_error_outline.png.meta │ ├── ic_trending_down.png │ ├── ic_trending_down.png.meta │ ├── ic_trending_flat.png │ ├── ic_trending_flat.png.meta │ ├── ic_trending_up.png │ └── ic_trending_up.png.meta ├── Scripts.meta └── Scripts │ ├── AddressablesSettingsEditor.cs │ ├── AddressablesSettingsEditor.cs.meta │ ├── AndroidPerformanceTunerWindow.cs │ ├── AndroidPerformanceTunerWindow.cs.meta │ ├── AnnotationMessageEditor.cs │ ├── AnnotationMessageEditor.cs.meta │ ├── DefaultMessages.cs │ ├── DefaultMessages.cs.meta │ ├── DeleteEnumWindow.cs │ ├── DeleteEnumWindow.cs.meta │ ├── DevDescriptor.cs │ ├── DevDescriptor.cs.meta │ ├── EditorHelper.cs │ ├── EditorHelper.cs.meta │ ├── EditorStatePrefs.cs │ ├── EditorStatePrefs.cs.meta │ ├── FidelityBuilder.cs │ ├── FidelityBuilder.cs.meta │ ├── FidelityMessageEditor.cs │ ├── FidelityMessageEditor.cs.meta │ ├── FidelityParametersEditor.cs │ ├── FidelityParametersEditor.cs.meta │ ├── FileDescriptorSet.cs │ ├── FileDescriptorSet.cs.meta │ ├── FileUtil.cs │ ├── FileUtil.cs.meta │ ├── Initializer.cs │ ├── Initializer.cs.meta │ ├── InstrumentationSettingsEditor.cs │ ├── InstrumentationSettingsEditor.cs.meta │ ├── IntegrationStepsEditor.cs │ ├── IntegrationStepsEditor.cs.meta │ ├── MessageBuilder.cs │ ├── MessageBuilder.cs.meta │ ├── MessageEditor.cs │ ├── MessageEditor.cs.meta │ ├── MessageUtil.cs │ ├── MessageUtil.cs.meta │ ├── Names.cs │ ├── Names.cs.meta │ ├── NewEnumWindow.cs │ ├── NewEnumWindow.cs.meta │ ├── Notification.cs │ ├── Notification.cs.meta │ ├── Paths.cs │ ├── Paths.cs.meta │ ├── PostGenerateGradle.cs │ ├── PostGenerateGradle.cs.meta │ ├── PredictionSettingsEditor.cs │ ├── PredictionSettingsEditor.cs.meta │ ├── ProjectData.cs │ ├── ProjectData.cs.meta │ ├── Proto.meta │ ├── Proto │ ├── EnumInfo.cs │ ├── EnumInfo.cs.meta │ ├── EnumInfoHelper.cs │ ├── EnumInfoHelper.cs.meta │ ├── FieldInfo.cs │ ├── FieldInfo.cs.meta │ ├── FileInfo.cs │ ├── FileInfo.cs.meta │ ├── MessageInfo.cs │ └── MessageInfo.cs.meta │ ├── ProtocCompiler.cs │ ├── ProtocCompiler.cs.meta │ ├── ResetAddressablesWindow.cs │ ├── ResetAddressablesWindow.cs.meta │ ├── SettingsEditor.cs │ ├── SettingsEditor.cs.meta │ ├── SettingsUtil.cs │ ├── SettingsUtil.cs.meta │ ├── Styles.cs │ ├── Styles.cs.meta │ ├── Trend.cs │ ├── Trend.cs.meta │ ├── TrendHelper.cs │ └── TrendHelper.cs.meta ├── LICENSE.md ├── LICENSE.md.meta ├── README.md ├── README.md.meta ├── Runtime.meta ├── Runtime ├── Google.Android.PerformanceTuner.asmdef ├── Google.Android.PerformanceTuner.asmdef.meta ├── Plugins.meta ├── Plugins │ ├── Android.meta │ └── Android │ │ ├── Google.Protobuf.dll │ │ ├── Google.Protobuf.dll.meta │ │ ├── arm64-v8a.meta │ │ ├── arm64-v8a │ │ ├── libc++_shared.so │ │ ├── libc++_shared.so.meta │ │ ├── libunitytuningfork.so │ │ └── libunitytuningfork.so.meta │ │ ├── armeabi-v7a.meta │ │ ├── armeabi-v7a │ │ ├── libc++_shared.so │ │ ├── libc++_shared.so.meta │ │ ├── libunitytuningfork.so │ │ └── libunitytuningfork.so.meta │ │ ├── x86-64.meta │ │ ├── x86-64 │ │ ├── libc++_shared.so │ │ ├── libc++_shared.so.meta │ │ ├── libunitytuningfork.so │ │ └── libunitytuningfork.so.meta │ │ ├── x86.meta │ │ └── x86 │ │ ├── libc++_shared.so │ │ ├── libc++_shared.so.meta │ │ ├── libunitytuningfork.so │ │ └── libunitytuningfork.so.meta ├── Scripts.meta └── Scripts │ ├── AdditionalLibraryMethods.cs │ ├── AdditionalLibraryMethods.cs.meta │ ├── AddressablesScenesEnumInfo.cs │ ├── AddressablesScenesEnumInfo.cs.meta │ ├── AndroidLibraryMethods.cs │ ├── AndroidLibraryMethods.cs.meta │ ├── AndroidPerformanceTuner.cs │ ├── AndroidPerformanceTuner.cs.meta │ ├── AndroidPerformanceTunerInternal.cs │ ├── AndroidPerformanceTunerInternal.cs.meta │ ├── CInitializationSettings.cs │ ├── CInitializationSettings.cs.meta │ ├── CProtobufSerialization.cs │ ├── CProtobufSerialization.cs.meta │ ├── DefaultLibraryMethods.cs │ ├── DefaultLibraryMethods.cs.meta │ ├── ErrorCode.cs │ ├── ErrorCode.cs.meta │ ├── FrameTracer.cs │ ├── FrameTracer.cs.meta │ ├── ILibraryMethods.cs │ ├── ILibraryMethods.cs.meta │ ├── InitializationSettings.cs │ ├── InitializationSettings.cs.meta │ ├── InstrumentationKeys.cs │ ├── InstrumentationKeys.cs.meta │ ├── LifecycleState.cs │ ├── LifecycleState.cs.meta │ ├── LoadingTimeMetadata.cs │ ├── LoadingTimeMetadata.cs.meta │ ├── MessageUtil.cs │ ├── MessageUtil.cs.meta │ ├── MetricLimits.cs │ ├── MetricLimits.cs.meta │ ├── Proto.meta │ ├── Proto │ ├── Tuningfork.cs │ └── Tuningfork.cs.meta │ ├── ProtoMessageType.cs │ ├── ProtoMessageType.cs.meta │ ├── QualityLevelPredictions.cs │ ├── QualityLevelPredictions.cs.meta │ ├── Result.cs │ ├── Result.cs.meta │ ├── SetupConfig.cs │ ├── SetupConfig.cs.meta │ ├── Submission.cs │ ├── Submission.cs.meta │ ├── TunerMode.cs │ ├── TunerMode.cs.meta │ ├── UploadTelemetryRequest.cs │ └── UploadTelemetryRequest.cs.meta ├── Samples~ └── Utilities │ ├── Editor.meta │ ├── Editor │ ├── LoadingSceneTrackerEditor.cs │ └── LoadingSceneTrackerEditor.cs.meta │ ├── Runtime.meta │ └── Runtime │ ├── LoadingSceneTracker.cs │ └── LoadingSceneTracker.cs.meta ├── link.xml ├── link.xml.meta ├── package.json └── package.json.meta /.allstar/binary_artifacts.yaml: -------------------------------------------------------------------------------- 1 | # Ignore reason: These binaries are officially published tools that are provided for developer convenience. 2 | ignorePaths: 3 | - Editor/Protoc/linux64/protoc 4 | - Editor/Protoc/mac/protoc 5 | - Editor/Protoc/win32/protoc.exe 6 | - Runtime/Plugins/Android/Google.Protobuf.dll 7 | - Runtime/Plugins/Android/arm64-v8a/libunitytuningfork.so 8 | - Runtime/Plugins/Android/arm64-v8a/libc++_shared.so 9 | - Runtime/Plugins/Android/armeabi-v7a/libunitytuningfork.so 10 | - Runtime/Plugins/Android/armeabi-v7a/libc++_shared.so 11 | - Runtime/Plugins/Android/x86-64/libunitytuningfork.so 12 | - Runtime/Plugins/Android/x86-64/libc++_shared.so 13 | - Runtime/Plugins/Android/x86/libunitytuningfork.so 14 | - Runtime/Plugins/Android/x86/libc++_shared.so 15 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | We'd love to accept your patches and contributions to this project. There are 4 | just a few small guidelines you need to follow. 5 | 6 | ## Contributor License Agreement 7 | 8 | Contributions to this project must be accompanied by a Contributor License 9 | Agreement. You (or your employer) retain the copyright to your contribution; 10 | this simply gives us permission to use and redistribute your contributions as 11 | part of the project. Head over to to see 12 | your current agreements on file or to sign a new one. 13 | 14 | You generally only need to submit a CLA once, so if you've already submitted one 15 | (even if it was for a different project), you probably don't need to do it 16 | again. 17 | 18 | ## Code reviews 19 | 20 | All submissions, including submissions by project members, require review. We 21 | use GitHub pull requests for this purpose. Consult 22 | [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more 23 | information on using pull requests. 24 | 25 | ## Community Guidelines 26 | 27 | This project follows 28 | [Google's Open Source Community Guidelines](https://opensource.google/conduct/). 29 | -------------------------------------------------------------------------------- /CONTRIBUTING.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba8e8f65be30d4279b16d3d196a034aa 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b81b0e8fce174cc4a9a38e274d4b8a9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Google.Android.PerformanceTuner.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Google.Android.PerformanceTuner.Editor", 3 | "rootNamespace": "", 4 | "references": [ 5 | "Google.Android.PerformanceTuner", 6 | "Unity.Addressables.Editor" 7 | ], 8 | "includePlatforms": [ 9 | "Editor" 10 | ], 11 | "excludePlatforms": [], 12 | "allowUnsafeCode": false, 13 | "overrideReferences": false, 14 | "precompiledReferences": [], 15 | "autoReferenced": true, 16 | "defineConstraints": [], 17 | "versionDefines": [ 18 | { 19 | "name": "com.unity.addressables", 20 | "expression": "1.19.4", 21 | "define": "APT_ADDRESSABLE_PACKAGE_PRESENT" 22 | } 23 | ], 24 | "noEngineReferences": false 25 | } -------------------------------------------------------------------------------- /Editor/Google.Android.PerformanceTuner.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68aa805bdef5440b8b2c2f9fc6ee7fb1 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/Protoc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20d8e611ac2bb4fc09340621ac265f3f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Protoc/linux64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3eeccc61ce989410abc94446c7c3425d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Protoc/linux64/protoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Editor/Protoc/linux64/protoc -------------------------------------------------------------------------------- /Editor/Protoc/linux64/protoc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5032fdd0f894b4aaeabcef5536e0c835 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/Protoc/mac.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 693b4519913394637bfda898e4d6fa51 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Protoc/mac/protoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Editor/Protoc/mac/protoc -------------------------------------------------------------------------------- /Editor/Protoc/mac/protoc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2707855519aa0442da9fa580dfc07403 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/Protoc/win32.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 843bd5e00f414447eb782bce856b5b60 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Protoc/win32/protoc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Editor/Protoc/win32/protoc.exe -------------------------------------------------------------------------------- /Editor/Protoc/win32/protoc.exe.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c0fa5a85ad2964065a29b9e93b1dd6c2 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09608a22e23fb47fc8c9bf8a82f168f5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Resources/baseline_info_outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Editor/Resources/baseline_info_outline.png -------------------------------------------------------------------------------- /Editor/Resources/baseline_info_outline.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ff0483b5c21346399922805eae5c97c 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 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: -1 35 | aniso: 1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 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 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 2 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 3 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | forceMaximumCompressionQuality_BC6H_BC7: 0 73 | - serializedVersion: 3 74 | buildTarget: Standalone 75 | maxTextureSize: 2048 76 | resizeAlgorithm: 0 77 | textureFormat: -1 78 | textureCompression: 1 79 | compressionQuality: 50 80 | crunchedCompression: 0 81 | allowsAlphaSplitting: 0 82 | overridden: 0 83 | androidETC2FallbackOverride: 0 84 | forceMaximumCompressionQuality_BC6H_BC7: 0 85 | - serializedVersion: 3 86 | buildTarget: Android 87 | maxTextureSize: 2048 88 | resizeAlgorithm: 0 89 | textureFormat: -1 90 | textureCompression: 1 91 | compressionQuality: 50 92 | crunchedCompression: 0 93 | allowsAlphaSplitting: 0 94 | overridden: 0 95 | androidETC2FallbackOverride: 0 96 | forceMaximumCompressionQuality_BC6H_BC7: 0 97 | spriteSheet: 98 | serializedVersion: 2 99 | sprites: [] 100 | outline: [] 101 | physicsShape: [] 102 | bones: [] 103 | spriteID: 104 | internalID: 0 105 | vertices: [] 106 | indices: 107 | edges: [] 108 | weights: [] 109 | secondaryTextures: [] 110 | spritePackingTag: 111 | pSDRemoveMatte: 0 112 | pSDShowRemoveMatteOption: 0 113 | userData: 114 | assetBundleName: 115 | assetBundleVariant: 116 | -------------------------------------------------------------------------------- /Editor/Resources/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Editor/Resources/ic_add.png -------------------------------------------------------------------------------- /Editor/Resources/ic_add.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f5e71f71f169e475e8e013dc854b1d78 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 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: -1 35 | aniso: 1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 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 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 2 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 3 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 64 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | forceMaximumCompressionQuality_BC6H_BC7: 0 73 | - serializedVersion: 3 74 | buildTarget: Standalone 75 | maxTextureSize: 64 76 | resizeAlgorithm: 0 77 | textureFormat: -1 78 | textureCompression: 1 79 | compressionQuality: 50 80 | crunchedCompression: 0 81 | allowsAlphaSplitting: 0 82 | overridden: 0 83 | androidETC2FallbackOverride: 0 84 | forceMaximumCompressionQuality_BC6H_BC7: 0 85 | - serializedVersion: 3 86 | buildTarget: Android 87 | maxTextureSize: 64 88 | resizeAlgorithm: 0 89 | textureFormat: -1 90 | textureCompression: 1 91 | compressionQuality: 50 92 | crunchedCompression: 0 93 | allowsAlphaSplitting: 0 94 | overridden: 0 95 | androidETC2FallbackOverride: 0 96 | forceMaximumCompressionQuality_BC6H_BC7: 0 97 | spriteSheet: 98 | serializedVersion: 2 99 | sprites: [] 100 | outline: [] 101 | physicsShape: [] 102 | bones: [] 103 | spriteID: 104 | internalID: 0 105 | vertices: [] 106 | indices: 107 | edges: [] 108 | weights: [] 109 | secondaryTextures: [] 110 | spritePackingTag: 111 | pSDRemoveMatte: 0 112 | pSDShowRemoveMatteOption: 0 113 | userData: 114 | assetBundleName: 115 | assetBundleVariant: 116 | -------------------------------------------------------------------------------- /Editor/Resources/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Editor/Resources/ic_done.png -------------------------------------------------------------------------------- /Editor/Resources/ic_done.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4a78f4a344964158bed6e3f3ed5f140 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 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: -1 35 | aniso: 1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 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 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 2 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 3 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 64 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | forceMaximumCompressionQuality_BC6H_BC7: 0 73 | - serializedVersion: 3 74 | buildTarget: Standalone 75 | maxTextureSize: 64 76 | resizeAlgorithm: 0 77 | textureFormat: -1 78 | textureCompression: 1 79 | compressionQuality: 50 80 | crunchedCompression: 0 81 | allowsAlphaSplitting: 0 82 | overridden: 0 83 | androidETC2FallbackOverride: 0 84 | forceMaximumCompressionQuality_BC6H_BC7: 0 85 | - serializedVersion: 3 86 | buildTarget: Android 87 | maxTextureSize: 64 88 | resizeAlgorithm: 0 89 | textureFormat: -1 90 | textureCompression: 1 91 | compressionQuality: 50 92 | crunchedCompression: 0 93 | allowsAlphaSplitting: 0 94 | overridden: 0 95 | androidETC2FallbackOverride: 0 96 | forceMaximumCompressionQuality_BC6H_BC7: 0 97 | spriteSheet: 98 | serializedVersion: 2 99 | sprites: [] 100 | outline: [] 101 | physicsShape: [] 102 | bones: [] 103 | spriteID: 104 | internalID: 0 105 | vertices: [] 106 | indices: 107 | edges: [] 108 | weights: [] 109 | secondaryTextures: [] 110 | spritePackingTag: 111 | pSDRemoveMatte: 0 112 | pSDShowRemoveMatteOption: 0 113 | userData: 114 | assetBundleName: 115 | assetBundleVariant: 116 | -------------------------------------------------------------------------------- /Editor/Resources/ic_error_outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Editor/Resources/ic_error_outline.png -------------------------------------------------------------------------------- /Editor/Resources/ic_error_outline.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e033ae57067443eab6d84145a71e011 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 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: -1 35 | aniso: 1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 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 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 2 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 3 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 64 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | forceMaximumCompressionQuality_BC6H_BC7: 0 73 | - serializedVersion: 3 74 | buildTarget: Standalone 75 | maxTextureSize: 64 76 | resizeAlgorithm: 0 77 | textureFormat: -1 78 | textureCompression: 1 79 | compressionQuality: 50 80 | crunchedCompression: 0 81 | allowsAlphaSplitting: 0 82 | overridden: 0 83 | androidETC2FallbackOverride: 0 84 | forceMaximumCompressionQuality_BC6H_BC7: 0 85 | - serializedVersion: 3 86 | buildTarget: Android 87 | maxTextureSize: 64 88 | resizeAlgorithm: 0 89 | textureFormat: -1 90 | textureCompression: 1 91 | compressionQuality: 50 92 | crunchedCompression: 0 93 | allowsAlphaSplitting: 0 94 | overridden: 0 95 | androidETC2FallbackOverride: 0 96 | forceMaximumCompressionQuality_BC6H_BC7: 0 97 | spriteSheet: 98 | serializedVersion: 2 99 | sprites: [] 100 | outline: [] 101 | physicsShape: [] 102 | bones: [] 103 | spriteID: 104 | internalID: 0 105 | vertices: [] 106 | indices: 107 | edges: [] 108 | weights: [] 109 | secondaryTextures: [] 110 | spritePackingTag: 111 | pSDRemoveMatte: 0 112 | pSDShowRemoveMatteOption: 0 113 | userData: 114 | assetBundleName: 115 | assetBundleVariant: 116 | -------------------------------------------------------------------------------- /Editor/Resources/ic_trending_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Editor/Resources/ic_trending_down.png -------------------------------------------------------------------------------- /Editor/Resources/ic_trending_down.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd5d16a2d7ea347feb59dd706d9af792 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 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: -1 35 | aniso: 1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 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 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 2 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 3 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 64 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | forceMaximumCompressionQuality_BC6H_BC7: 0 73 | - serializedVersion: 3 74 | buildTarget: Standalone 75 | maxTextureSize: 64 76 | resizeAlgorithm: 0 77 | textureFormat: -1 78 | textureCompression: 1 79 | compressionQuality: 50 80 | crunchedCompression: 0 81 | allowsAlphaSplitting: 0 82 | overridden: 0 83 | androidETC2FallbackOverride: 0 84 | forceMaximumCompressionQuality_BC6H_BC7: 0 85 | - serializedVersion: 3 86 | buildTarget: Android 87 | maxTextureSize: 64 88 | resizeAlgorithm: 0 89 | textureFormat: -1 90 | textureCompression: 1 91 | compressionQuality: 50 92 | crunchedCompression: 0 93 | allowsAlphaSplitting: 0 94 | overridden: 0 95 | androidETC2FallbackOverride: 0 96 | forceMaximumCompressionQuality_BC6H_BC7: 0 97 | spriteSheet: 98 | serializedVersion: 2 99 | sprites: [] 100 | outline: [] 101 | physicsShape: [] 102 | bones: [] 103 | spriteID: 104 | internalID: 0 105 | vertices: [] 106 | indices: 107 | edges: [] 108 | weights: [] 109 | secondaryTextures: [] 110 | spritePackingTag: 111 | pSDRemoveMatte: 0 112 | pSDShowRemoveMatteOption: 0 113 | userData: 114 | assetBundleName: 115 | assetBundleVariant: 116 | -------------------------------------------------------------------------------- /Editor/Resources/ic_trending_flat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Editor/Resources/ic_trending_flat.png -------------------------------------------------------------------------------- /Editor/Resources/ic_trending_flat.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c319dced1591b4798b1811b812db39ef 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 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: -1 35 | aniso: 1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 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 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 2 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 3 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 64 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | forceMaximumCompressionQuality_BC6H_BC7: 0 73 | - serializedVersion: 3 74 | buildTarget: Standalone 75 | maxTextureSize: 64 76 | resizeAlgorithm: 0 77 | textureFormat: -1 78 | textureCompression: 1 79 | compressionQuality: 50 80 | crunchedCompression: 0 81 | allowsAlphaSplitting: 0 82 | overridden: 0 83 | androidETC2FallbackOverride: 0 84 | forceMaximumCompressionQuality_BC6H_BC7: 0 85 | - serializedVersion: 3 86 | buildTarget: Android 87 | maxTextureSize: 64 88 | resizeAlgorithm: 0 89 | textureFormat: -1 90 | textureCompression: 1 91 | compressionQuality: 50 92 | crunchedCompression: 0 93 | allowsAlphaSplitting: 0 94 | overridden: 0 95 | androidETC2FallbackOverride: 0 96 | forceMaximumCompressionQuality_BC6H_BC7: 0 97 | spriteSheet: 98 | serializedVersion: 2 99 | sprites: [] 100 | outline: [] 101 | physicsShape: [] 102 | bones: [] 103 | spriteID: 104 | internalID: 0 105 | vertices: [] 106 | indices: 107 | edges: [] 108 | weights: [] 109 | secondaryTextures: [] 110 | spritePackingTag: 111 | pSDRemoveMatte: 0 112 | pSDShowRemoveMatteOption: 0 113 | userData: 114 | assetBundleName: 115 | assetBundleVariant: 116 | -------------------------------------------------------------------------------- /Editor/Resources/ic_trending_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Editor/Resources/ic_trending_up.png -------------------------------------------------------------------------------- /Editor/Resources/ic_trending_up.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec5fc349e35eb45a6bbe4e824d9a3ae5 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 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: -1 35 | aniso: 1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 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 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 2 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 3 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 64 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | forceMaximumCompressionQuality_BC6H_BC7: 0 73 | - serializedVersion: 3 74 | buildTarget: Standalone 75 | maxTextureSize: 64 76 | resizeAlgorithm: 0 77 | textureFormat: -1 78 | textureCompression: 1 79 | compressionQuality: 50 80 | crunchedCompression: 0 81 | allowsAlphaSplitting: 0 82 | overridden: 0 83 | androidETC2FallbackOverride: 0 84 | forceMaximumCompressionQuality_BC6H_BC7: 0 85 | - serializedVersion: 3 86 | buildTarget: Android 87 | maxTextureSize: 64 88 | resizeAlgorithm: 0 89 | textureFormat: -1 90 | textureCompression: 1 91 | compressionQuality: 50 92 | crunchedCompression: 0 93 | allowsAlphaSplitting: 0 94 | overridden: 0 95 | androidETC2FallbackOverride: 0 96 | forceMaximumCompressionQuality_BC6H_BC7: 0 97 | spriteSheet: 98 | serializedVersion: 2 99 | sprites: [] 100 | outline: [] 101 | physicsShape: [] 102 | bones: [] 103 | spriteID: 104 | internalID: 0 105 | vertices: [] 106 | indices: 107 | edges: [] 108 | weights: [] 109 | secondaryTextures: [] 110 | spritePackingTag: 111 | pSDRemoveMatte: 0 112 | pSDShowRemoveMatteOption: 0 113 | userData: 114 | assetBundleName: 115 | assetBundleVariant: 116 | -------------------------------------------------------------------------------- /Editor/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a5c7fba3ba8b242f0bab279015931c99 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Scripts/AddressablesSettingsEditor.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2022 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using UnityEngine; 23 | using UnityEditor; 24 | using UnityEditor.Compilation; 25 | 26 | // Disable warning for unused updateButtonString if addressables package is not present. 27 | #pragma warning disable CS0414 28 | 29 | 30 | namespace Google.Android.PerformanceTuner.Editor 31 | { 32 | public class AddressablesSettingsEditor 33 | { 34 | private readonly SetupConfig m_SetupConfig; 35 | private readonly string updateButtonString = "Update Addressables Scenes"; 36 | private readonly string errorMessage = 37 | "Only available in Unity 2019.3 or higher if the addressable package is present in the project."; 38 | private readonly string noAddressablesMessage = 39 | "There are currently no addressables scenes recorded by APT."; 40 | 41 | private readonly string resetAddressables = "Reset Addressables Scenes"; 42 | 43 | private Vector2 scrollPos; 44 | public AddressablesSettingsEditor(SetupConfig setupConfig) 45 | { 46 | m_SetupConfig = setupConfig; 47 | } 48 | 49 | public void OnGUI() 50 | { 51 | #if APT_ADDRESSABLE_PACKAGE_PRESENT && UNITY_2019_3_OR_NEWER 52 | if(!m_SetupConfig) return; 53 | 54 | EditorGUILayout.BeginHorizontal(); 55 | GUILayout.FlexibleSpace(); 56 | if (GUILayout.Button(updateButtonString, GUILayout.ExpandWidth(false))) 57 | { 58 | m_SetupConfig.UpdateAddressablesScenes(); 59 | CompilationPipeline.RequestScriptCompilation(); // Requires 2019.3 60 | }; 61 | EditorGUILayout.EndHorizontal(); 62 | 63 | if(m_SetupConfig.AreAddressablesScenesPresent()){ 64 | scrollPos = EditorGUILayout.BeginScrollView(scrollPos); 65 | for (int i = 0; i < m_SetupConfig.AddressablesScenes.Count; i++) 66 | { 67 | EditorGUILayout.LabelField( 68 | String.Format("{0}: {1}", 69 | m_SetupConfig.AddressablesScenes[i].scenePath, 70 | m_SetupConfig.AddressablesScenes[i].value)); 71 | } 72 | EditorGUILayout.EndScrollView(); 73 | } 74 | else 75 | { 76 | EditorGUILayout.HelpBox(noAddressablesMessage, MessageType.Info); 77 | } 78 | DisplayResetButton(); 79 | #else 80 | EditorGUILayout.HelpBox(errorMessage, MessageType.Warning); 81 | #endif 82 | } 83 | 84 | private void DisplayResetButton() 85 | { 86 | // Move to bottom of window. 87 | EditorGUILayout.BeginVertical(); 88 | GUILayout.FlexibleSpace(); 89 | 90 | // Move towards the right. 91 | EditorGUILayout.BeginHorizontal(); 92 | GUILayout.FlexibleSpace(); 93 | if (GUILayout.Button(resetAddressables)) 94 | { 95 | ResetAddressablesWindow.ShowWindow(m_SetupConfig); 96 | } 97 | EditorGUILayout.EndHorizontal(); 98 | 99 | EditorGUILayout.EndVertical(); 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /Editor/Scripts/AddressablesSettingsEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c01728e26b624df189c577428ef109b 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/AndroidPerformanceTunerWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5aec9e026a2904c39a42634a819c5b5c 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/AnnotationMessageEditor.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Text.RegularExpressions; 22 | using UnityEditor; 23 | using UnityEngine; 24 | using Google.Android.PerformanceTuner.Editor.Proto; 25 | using Google.Protobuf.Reflection; 26 | 27 | namespace Google.Android.PerformanceTuner.Editor 28 | { 29 | public class AnnotationMessageEditor : MessageEditor 30 | { 31 | const string k_BasicInfo = " The scene is used as an annotation.\n" + 32 | " The annotation is set automatically when active scene is changed."; 33 | 34 | const string k_SceneInfo = 35 | "This parameter is recognized as a scene parameter. " + 36 | "If your game is not using / not matching unity scene system, you can remove it from your annotation."; 37 | 38 | 39 | readonly GUIContent m_SceneFieldInfo; 40 | 41 | readonly GUIContent m_LoadingFieldInfo; 42 | 43 | 44 | protected override string basicInfo 45 | { 46 | get { return k_BasicInfo; } 47 | } 48 | 49 | readonly string[] m_Headers = new string[2] {"Type", "Parameter name "}; 50 | 51 | protected override string[] headers 52 | { 53 | get { return m_Headers; } 54 | } 55 | 56 | public AnnotationMessageEditor(ProjectData projectData, SetupConfig config, FileInfo protoFile, 57 | MessageDescriptor descriptor, 58 | EnumInfoHelper enumInfoHelper) : base( 59 | projectData, 60 | config, 61 | descriptor, 62 | ProtoMessageType.Annotation, 63 | DefaultMessages.annotationMessage, 64 | protoFile, 65 | enumInfoHelper) 66 | { 67 | var icon = (Texture) Resources.Load("baseline_info_outline"); 68 | var error = (Texture) Resources.Load("ic_error_outline"); 69 | m_SceneFieldInfo = new GUIContent(icon, k_SceneInfo); 70 | m_LoadingFieldInfo = new GUIContent(error, Names.removeLoadingStateTooltip); 71 | } 72 | 73 | public override void OnGUI() 74 | { 75 | if (!m_Config.useAdvancedAnnotations && m_ProjectData.hasLoadingState) 76 | { 77 | GUILayout.Space(15); 78 | GUILayout.BeginHorizontal(); 79 | EditorGUILayout.HelpBox(Names.fixDefaultAnnotationMessage, MessageType.Error); 80 | if (GUILayout.Button("Fix")) 81 | { 82 | SaveState(); 83 | } 84 | 85 | GUILayout.EndHorizontal(); 86 | } 87 | 88 | base.OnGUI(); 89 | } 90 | 91 | protected override FieldInfo RenderInfo(FieldInfo info, Rect rect, int index) 92 | { 93 | Rect infoRect = new Rect(rect); 94 | infoRect.width = 20; 95 | // Align icon on the center. 96 | infoRect.x--; 97 | infoRect.y--; 98 | 99 | Rect enumRect = new Rect(rect); 100 | enumRect.x = infoRect.xMax; 101 | enumRect.width = rect.width / 3 - infoRect.width; 102 | 103 | Rect textRect = new Rect(rect); 104 | textRect.x = enumRect.xMax; 105 | textRect.width = rect.width - enumRect.width - infoRect.width; 106 | 107 | if (DefaultMessages.IsSceneField(info)) 108 | { 109 | EditorGUI.LabelField(infoRect, m_SceneFieldInfo); 110 | } 111 | else if (DefaultMessages.IsLoadingStateField(info)) 112 | { 113 | EditorGUI.LabelField(infoRect, m_LoadingFieldInfo); 114 | } 115 | 116 | Selection selection = RenderEnumSelection(enumRect, info.enumTypeIndex); 117 | info.enumTypeIndex = selection.id; 118 | info.enumType = selection.name; 119 | string input = EditorGUI.TextField(textRect, info.name); 120 | // String should contain only a-z, A-Z, numbers and '_' symbols. 121 | info.name = Regex.Replace(input, "[^a-zA-Z0-9_]", ""); 122 | return info; 123 | } 124 | 125 | protected override void ApplyState(EditorState state) 126 | { 127 | // Nothing to apply for annotation message. 128 | } 129 | } 130 | } -------------------------------------------------------------------------------- /Editor/Scripts/AnnotationMessageEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8199049c5ca264cb993e280afa7cff6b 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/DefaultMessages.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Collections.Generic; 22 | using Google.Android.PerformanceTuner.Editor.Proto; 23 | using Google.Protobuf; 24 | using Google.Protobuf.Reflection; 25 | 26 | namespace Google.Android.PerformanceTuner.Editor 27 | { 28 | public class DefaultMessages 29 | { 30 | /* 31 | * Default proto: 32 | * syntax = "proto3"; 33 | * option csharp_namespace = "Google.Android.PerformanceTuner"; 34 | * enum Scene { 35 | * SCENE_INVALID = 0; 36 | * } 37 | * message Annotation { 38 | * Scene scene = 1; 39 | * } 40 | * message FidelityParams { 41 | * int32 level = 1; 42 | * } 43 | */ 44 | 45 | public static readonly ByteString serializedDefaultProto = ByteString.FromBase64(string.Concat( 46 | "ChRkZXZfdHVuaW5nZm9yay5wcm90byIjCgpBbm5vdGF0aW9uEhUKBXNjZW5l", 47 | "GAEgASgOMgYuU2NlbmUiHwoORmlkZWxpdHlQYXJhbXMSDQoFbGV2ZWwYASAB", 48 | "KAUqGgoFU2NlbmUSEQoNU0NFTkVfSU5WQUxJRBAAQiKqAh9Hb29nbGUuQW5k", 49 | "cm9pZC5QZXJmb3JtYW5jZVR1bmVyYgZwcm90bzM=")); 50 | 51 | 52 | static readonly FieldInfo k_SceneField = new FieldInfo() 53 | { 54 | name = Names.sceneFieldName, 55 | fieldType = FieldInfo.FieldType.Enum, 56 | enumType = Names.sceneEnumName, 57 | }; 58 | 59 | static readonly FieldInfo k_QualityLevelField = new FieldInfo() 60 | { 61 | name = "level", 62 | fieldType = FieldInfo.FieldType.Int32, 63 | }; 64 | 65 | 66 | public static readonly MessageInfo annotationMessage = new MessageInfo 67 | { 68 | name = "Annotation", 69 | fields = new List {k_SceneField} 70 | }; 71 | 72 | 73 | public static readonly MessageInfo fidelityMessage = new MessageInfo 74 | { 75 | name = "FidelityParams", 76 | fields = new List {k_QualityLevelField} 77 | }; 78 | 79 | public static bool IsSceneField(FieldDescriptor field) 80 | { 81 | return field.Name == k_SceneField.name && 82 | field.FieldType == FieldType.Enum && 83 | field.EnumType.Name == k_SceneField.enumType; 84 | } 85 | 86 | public static bool IsLoadingStateField(FieldDescriptor field) 87 | { 88 | return field.Name == Names.loadingStateFieldName && 89 | field.FieldType == FieldType.Enum && 90 | field.EnumType.Name == Names.loadingStateEnumName; 91 | } 92 | 93 | public static bool IsSceneField(FieldInfo field) 94 | { 95 | return field.name == k_SceneField.name && 96 | field.fieldType == FieldInfo.FieldType.Enum && 97 | field.enumType == k_SceneField.enumType; 98 | } 99 | 100 | public static bool IsLoadingStateField(FieldInfo field) 101 | { 102 | return field.name == Names.loadingStateFieldName && 103 | field.fieldType == FieldInfo.FieldType.Enum && 104 | field.enumType == Names.loadingStateEnumName; 105 | } 106 | } 107 | } -------------------------------------------------------------------------------- /Editor/Scripts/DefaultMessages.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9243df92dcf0491d902e0afe1b422575 3 | timeCreated: 1576256433 -------------------------------------------------------------------------------- /Editor/Scripts/DeleteEnumWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49a52409ee7794f7bac99d636ea1e38d 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/DevDescriptor.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using Google.Protobuf; 25 | using Google.Protobuf.Reflection; 26 | using UnityEngine; 27 | 28 | namespace Google.Android.PerformanceTuner.Editor 29 | { 30 | /// 31 | /// Wrapper around DevTuningfork.cs. 32 | /// Loads message descriptors and parsers from file descriptor. 33 | /// File descriptor must contain - `Annotation` and `FidelityParams` messages. 34 | /// 35 | public class DevDescriptor 36 | { 37 | /// 38 | /// Create new wrapper for DevTuningfork proto. 39 | /// 40 | /// serialized data for file descriptor 41 | public DevDescriptor(ByteString serializedData) 42 | { 43 | m_SerializedData = serializedData; 44 | } 45 | 46 | /// 47 | /// Create new wrapper for DevTuningfork proto. 48 | /// 49 | /// bytes as read from .descriptor file 50 | public DevDescriptor(byte[] bytes) 51 | { 52 | m_SerializedBytes = bytes; 53 | } 54 | 55 | public bool Build() 56 | { 57 | try 58 | { 59 | IReadOnlyList files; 60 | if (m_SerializedData != null) 61 | { 62 | files = FileDescriptor.BuildFromByteStrings(new[] {m_SerializedData}); 63 | } 64 | else if (m_SerializedBytes != null) 65 | { 66 | var fileDescriptorSet = FileDescriptorSet.Parser.ParseFrom(m_SerializedBytes); 67 | files = FileDescriptor.BuildFromByteStrings(fileDescriptorSet.File); 68 | } 69 | else 70 | { 71 | throw new InvalidOperationException("DevDescriptor is not properly initialized."); 72 | } 73 | 74 | fileDescriptor = files[0]; 75 | fidelityMessage = fileDescriptor.MessageTypes.First(x => x.Name == "FidelityParams"); 76 | annotationMessage = fileDescriptor.MessageTypes.First(x => x.Name == "Annotation"); 77 | var loadingField = annotationMessage.Fields 78 | .InDeclarationOrder() 79 | .FirstOrDefault(DefaultMessages.IsLoadingStateField); 80 | var sceneField = annotationMessage.Fields 81 | .InDeclarationOrder() 82 | .FirstOrDefault(DefaultMessages.IsSceneField); 83 | // As message field's indexes start from 1, return 0 if field is not found. 84 | loadingAnnotationIndex = loadingField?.FieldNumber ?? 0; 85 | sceneAnnotationIndex = sceneField?.FieldNumber ?? 0; 86 | annotationEnumSizes = 87 | annotationMessage.Fields.InDeclarationOrder() 88 | .Select(x => x.EnumType.Values.Count).ToList(); 89 | fidelityFieldNames = fidelityMessage.Fields.InDeclarationOrder().Select(x => x.Name).ToList(); 90 | return true; 91 | } 92 | catch (Exception e) 93 | { 94 | Debug.Log("Could not build DevDescriptor, " + e); 95 | return false; 96 | } 97 | } 98 | 99 | 100 | // ByteString or byte[] must be set. 101 | readonly ByteString m_SerializedData; 102 | readonly byte[] m_SerializedBytes; 103 | public FileDescriptor fileDescriptor { get; private set; } 104 | public MessageDescriptor fidelityMessage { get; private set; } 105 | public MessageDescriptor annotationMessage { get; private set; } 106 | public int loadingAnnotationIndex { get; private set; } 107 | public int sceneAnnotationIndex { get; private set; } 108 | public IList fidelityFieldNames { get; private set; } 109 | public List annotationEnumSizes { get; private set; } 110 | } 111 | } -------------------------------------------------------------------------------- /Editor/Scripts/DevDescriptor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b2e638947bae43a28a1705a70e51c687 3 | timeCreated: 1580406694 -------------------------------------------------------------------------------- /Editor/Scripts/EditorHelper.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Google.Android.PerformanceTuner.Editor 22 | { 23 | using UnityEditor; 24 | using UnityEngine; 25 | 26 | public static class EditorHelper 27 | { 28 | public static void LineSeparator() 29 | { 30 | Rect rect = EditorGUILayout.GetControlRect(GUILayout.Height(15)); 31 | rect.height = 1; 32 | rect.y += 7; 33 | EditorGUI.DrawRect(rect, Color.grey); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Editor/Scripts/EditorHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d4478bb33ca824e338fabfab004e5e48 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/EditorStatePrefs.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using UnityEditor; 22 | using UnityEngine; 23 | 24 | namespace Google.Android.PerformanceTuner.Editor 25 | { 26 | public class EditorStatePrefs where T : class 27 | { 28 | const string k_KeyPrefix = "android-performance-tuner-cache-"; 29 | readonly string m_Key; 30 | readonly T m_DefaultValue; 31 | 32 | public EditorStatePrefs(string key, T defaultValue) 33 | { 34 | m_Key = k_KeyPrefix + key; 35 | m_DefaultValue = defaultValue; 36 | } 37 | 38 | public T Get() 39 | { 40 | if (!PlayerPrefs.HasKey(m_Key)) Set(m_DefaultValue); 41 | var json = PlayerPrefs.GetString(m_Key); 42 | return JsonUtility.FromJson(json); 43 | } 44 | 45 | public void Set(T value) 46 | { 47 | var json = JsonUtility.ToJson(value); 48 | PlayerPrefs.SetString(m_Key, json); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Editor/Scripts/EditorStatePrefs.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd0c834f561a943cc89d3b6923714b90 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/FidelityBuilder.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Google.Android.PerformanceTuner.Editor 22 | { 23 | public static class FidelityBuilder 24 | { 25 | public static readonly MessageBuilder builder = new MessageBuilder(new MessageBuilder.Parameters() 26 | { 27 | assemblyFullName = "Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", 28 | fullName = "Google.Android.PerformanceTuner.FidelityParams" 29 | }); 30 | } 31 | } -------------------------------------------------------------------------------- /Editor/Scripts/FidelityBuilder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3566756156c4e1b890e244701c30453 3 | timeCreated: 1580898596 -------------------------------------------------------------------------------- /Editor/Scripts/FidelityMessageEditor.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Text.RegularExpressions; 22 | using Google.Protobuf.Reflection; 23 | using UnityEditor; 24 | using UnityEngine; 25 | using Google.Android.PerformanceTuner.Editor.Proto; 26 | 27 | namespace Google.Android.PerformanceTuner.Editor 28 | { 29 | public class FidelityMessageEditor : MessageEditor 30 | { 31 | const string k_BasicInfo = 32 | " Unity quality levels are used as Android Performance Tuner quality levels.\n" + 33 | " Unity quality settings are updated automatically when they're updated from the server."; 34 | 35 | protected override string basicInfo 36 | { 37 | get { return k_BasicInfo; } 38 | } 39 | 40 | readonly string[] m_Headers = new string[3] {"Type", "Parameter name", ""}; 41 | 42 | protected override string[] headers 43 | { 44 | get { return m_Headers; } 45 | } 46 | 47 | public FidelityMessageEditor(ProjectData projectData, SetupConfig config, FileInfo protoFile, 48 | MessageDescriptor descriptor, 49 | EnumInfoHelper enumInfoHelper) : base( 50 | projectData, 51 | config, 52 | descriptor, 53 | ProtoMessageType.FidelityParams, 54 | DefaultMessages.fidelityMessage, 55 | protoFile, 56 | enumInfoHelper) 57 | { 58 | } 59 | 60 | protected override FieldInfo RenderInfo(FieldInfo info, Rect rect, int index) 61 | { 62 | float blockWidth = rect.width / 3; 63 | 64 | Rect enumRect = new Rect(rect); 65 | enumRect.width = blockWidth; 66 | 67 | Rect enumSelectionRect = new Rect(rect); 68 | enumSelectionRect.x = enumRect.xMax; 69 | enumSelectionRect.width = blockWidth; 70 | 71 | Rect textRect = new Rect(rect); 72 | textRect.x = enumRect.xMax; 73 | textRect.width = 2 * blockWidth; 74 | 75 | info.fieldType = (FieldInfo.FieldType) EditorGUI.EnumPopup(enumRect, info.fieldType); 76 | 77 | if (info.fieldType == FieldInfo.FieldType.Enum) 78 | { 79 | Selection selection = RenderEnumSelection(enumSelectionRect, info.enumTypeIndex); 80 | info.enumTypeIndex = selection.id; 81 | info.enumType = selection.name; 82 | 83 | //Change textRect size if enum selection is rendered 84 | textRect.x = enumSelectionRect.xMax; 85 | textRect.width = blockWidth; 86 | } 87 | 88 | // String should contain only a-z, A-Z, numbers and '_' symbols. 89 | string input = EditorGUI.TextField(textRect, info.name); 90 | info.name = Regex.Replace(input, "[^a-zA-Z0-9_]", ""); 91 | 92 | return info; 93 | } 94 | 95 | protected override void ApplyState(EditorState state) 96 | { 97 | if (!state.useAdvanced) 98 | { 99 | m_ProjectData.DeleteAllFidelityMessages(); 100 | } 101 | } 102 | } 103 | } -------------------------------------------------------------------------------- /Editor/Scripts/FidelityMessageEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d625768eba3044e0828121344a119bf 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/FidelityParametersEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 78414aa9bcb9b4f028611d6a72f1373f 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/FileDescriptorSet.cs: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: Private/Editor/Proto/file_descriptor_set.proto 3 | #pragma warning disable 1591, 0612, 3021 4 | #region Designer generated code 5 | 6 | using pb = global::Google.Protobuf; 7 | using pbc = global::Google.Protobuf.Collections; 8 | using pbr = global::Google.Protobuf.Reflection; 9 | using scg = global::System.Collections.Generic; 10 | namespace Google.Android.PerformanceTuner { 11 | 12 | /// Holder for reflection information generated from Private/Editor/Proto/file_descriptor_set.proto 13 | public static partial class FileDescriptorSetReflection { 14 | 15 | #region Descriptor 16 | /// File descriptor for Private/Editor/Proto/file_descriptor_set.proto 17 | public static pbr::FileDescriptor Descriptor { 18 | get { return descriptor; } 19 | } 20 | private static pbr::FileDescriptor descriptor; 21 | 22 | static FileDescriptorSetReflection() { 23 | byte[] descriptorData = global::System.Convert.FromBase64String( 24 | string.Concat( 25 | "Ci5Qcml2YXRlL0VkaXRvci9Qcm90by9maWxlX2Rlc2NyaXB0b3Jfc2V0LnBy", 26 | "b3RvEhxnb29nbGUucGVyZm9ybWFuY2VwYXJhbWV0ZXJzIiEKEUZpbGVEZXNj", 27 | "cmlwdG9yU2V0EgwKBGZpbGUYASADKAxCIqoCH0dvb2dsZS5BbmRyb2lkLlBl", 28 | "cmZvcm1hbmNlVHVuZXJiBnByb3RvMw==")); 29 | descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, 30 | new pbr::FileDescriptor[] { }, 31 | new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { 32 | new pbr::GeneratedClrTypeInfo(typeof(global::Google.Android.PerformanceTuner.FileDescriptorSet), global::Google.Android.PerformanceTuner.FileDescriptorSet.Parser, new[]{ "File" }, null, null, null) 33 | })); 34 | } 35 | #endregion 36 | 37 | } 38 | #region Messages 39 | public sealed partial class FileDescriptorSet : pb::IMessage { 40 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileDescriptorSet()); 41 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 42 | public static pb::MessageParser Parser { get { return _parser; } } 43 | 44 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 45 | public static pbr::MessageDescriptor Descriptor { 46 | get { return global::Google.Android.PerformanceTuner.FileDescriptorSetReflection.Descriptor.MessageTypes[0]; } 47 | } 48 | 49 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 50 | pbr::MessageDescriptor pb::IMessage.Descriptor { 51 | get { return Descriptor; } 52 | } 53 | 54 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 55 | public FileDescriptorSet() { 56 | OnConstruction(); 57 | } 58 | 59 | partial void OnConstruction(); 60 | 61 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 62 | public FileDescriptorSet(FileDescriptorSet other) : this() { 63 | file_ = other.file_.Clone(); 64 | } 65 | 66 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 67 | public FileDescriptorSet Clone() { 68 | return new FileDescriptorSet(this); 69 | } 70 | 71 | /// Field number for the "file" field. 72 | public const int FileFieldNumber = 1; 73 | private static readonly pb::FieldCodec _repeated_file_codec 74 | = pb::FieldCodec.ForBytes(10); 75 | private readonly pbc::RepeatedField file_ = new pbc::RepeatedField(); 76 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 77 | public pbc::RepeatedField File { 78 | get { return file_; } 79 | } 80 | 81 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 82 | public override bool Equals(object other) { 83 | return Equals(other as FileDescriptorSet); 84 | } 85 | 86 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 87 | public bool Equals(FileDescriptorSet other) { 88 | if (ReferenceEquals(other, null)) { 89 | return false; 90 | } 91 | if (ReferenceEquals(other, this)) { 92 | return true; 93 | } 94 | if(!file_.Equals(other.file_)) return false; 95 | return true; 96 | } 97 | 98 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 99 | public override int GetHashCode() { 100 | int hash = 1; 101 | hash ^= file_.GetHashCode(); 102 | return hash; 103 | } 104 | 105 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 106 | public override string ToString() { 107 | return pb::JsonFormatter.ToDiagnosticString(this); 108 | } 109 | 110 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 111 | public void WriteTo(pb::CodedOutputStream output) { 112 | file_.WriteTo(output, _repeated_file_codec); 113 | } 114 | 115 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 116 | public int CalculateSize() { 117 | int size = 0; 118 | size += file_.CalculateSize(_repeated_file_codec); 119 | return size; 120 | } 121 | 122 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 123 | public void MergeFrom(FileDescriptorSet other) { 124 | if (other == null) { 125 | return; 126 | } 127 | file_.Add(other.file_); 128 | } 129 | 130 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 131 | public void MergeFrom(pb::CodedInputStream input) { 132 | uint tag; 133 | while ((tag = input.ReadTag()) != 0) { 134 | switch(tag) { 135 | default: 136 | input.SkipLastField(); 137 | break; 138 | case 10: { 139 | file_.AddEntriesFrom(input, _repeated_file_codec); 140 | break; 141 | } 142 | } 143 | } 144 | } 145 | 146 | } 147 | 148 | #endregion 149 | 150 | } 151 | 152 | #endregion Designer generated code 153 | -------------------------------------------------------------------------------- /Editor/Scripts/FileDescriptorSet.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 06a81744b7c994d8b8a49c582a1cac84 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/FileUtil.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 190cc0e4d85a4fa3a1b4573c962e900f 3 | timeCreated: 1576771881 -------------------------------------------------------------------------------- /Editor/Scripts/Initializer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3551a83c494d044c2ba5ed2a17205b48 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/InstrumentationSettingsEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d26b0853527664c83bb47b20cb58a1cc 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/IntegrationStepsEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad3431d4c05e4f72beebe5a7c0a7bf7c 3 | timeCreated: 1620923579 -------------------------------------------------------------------------------- /Editor/Scripts/MessageBuilder.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using Google.Protobuf; 23 | 24 | namespace Google.Android.PerformanceTuner.Editor 25 | { 26 | public class MessageBuilder 27 | { 28 | public class Parameters 29 | { 30 | // e.g "Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" 31 | public string assemblyFullName; 32 | 33 | // e.g. "Google.Android.PerformanceTuner.FidelityParams" 34 | public string fullName; 35 | } 36 | 37 | public class GenericParser : Parser where T : class, IMessage, new() 38 | { 39 | public override IMessage ParseFrom(ByteString data) 40 | { 41 | var parser = new MessageParser(() => new T()); 42 | return parser.ParseFrom(data); 43 | } 44 | } 45 | 46 | public abstract class Parser 47 | { 48 | public abstract IMessage ParseFrom(ByteString data); 49 | } 50 | 51 | public MessageBuilder(Parameters parameters) 52 | { 53 | m_Parameters = parameters; 54 | 55 | // Try to find in default assemble first. 56 | m_Type = FindAssemblyType(true); 57 | if (m_Type == null) m_Type = FindAssemblyType(false); 58 | } 59 | 60 | public bool valid 61 | { 62 | get { return m_Type != null; } 63 | } 64 | 65 | Parser m_Parser; 66 | 67 | public IMessage CreateNew() 68 | { 69 | if (m_Type == null) 70 | throw new TypeAccessException(String.Format("Message type {0} doesn't exist", m_Parameters.fullName)); 71 | return (IMessage) Activator.CreateInstance(m_Type); 72 | } 73 | 74 | public IMessage ParseFrom(ByteString data) 75 | { 76 | if (m_Parser == null) 77 | { 78 | // Create a parser for the message type. 79 | Type genericParserType = typeof(GenericParser<>); 80 | Type parserType = genericParserType.MakeGenericType(m_Type); 81 | m_Parser = (Parser) Activator.CreateInstance(parserType); 82 | } 83 | 84 | return m_Parser.ParseFrom(data); 85 | } 86 | 87 | readonly Type m_Type; 88 | 89 | readonly Parameters m_Parameters; 90 | 91 | Type FindAssemblyType(bool searchInDefaultOnly) 92 | { 93 | foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) 94 | { 95 | //TODO(kseniia): Check if type can be found properly in different assemblies 96 | if (searchInDefaultOnly && assembly.FullName != m_Parameters.assemblyFullName) continue; 97 | if (assembly.IsDynamic) continue; 98 | foreach (var type in assembly.ExportedTypes) 99 | { 100 | if (type.FullName == m_Parameters.fullName && typeof(IMessage).IsAssignableFrom(type)) 101 | { 102 | return type; 103 | } 104 | } 105 | } 106 | 107 | return null; 108 | } 109 | } 110 | } -------------------------------------------------------------------------------- /Editor/Scripts/MessageBuilder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 890377d96bfad4a98ab711a381e7be2c 3 | timeCreated: 1580470756 -------------------------------------------------------------------------------- /Editor/Scripts/MessageEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a79c7bb7d2be145e6b9196d525137c9f 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/MessageUtil.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using Google.Protobuf; 22 | using Google.Protobuf.Reflection; 23 | using UnityEngine; 24 | using System.Collections.Generic; 25 | 26 | namespace Google.Android.PerformanceTuner.Editor 27 | { 28 | /// 29 | /// Helper class to access Android Performance Tuner proto messages - Annotation and Fidelity Parameters. 30 | /// 31 | public static class MessageUtil 32 | { 33 | /// 34 | /// Adjust all enum values in the message to exclude 0-index value (Invalid) 35 | /// 36 | /// Proto message to adjust 37 | public static void AdjustEnumValues(IMessage message) 38 | { 39 | foreach (var field in message.Descriptor.Fields.InFieldNumberOrder()) 40 | { 41 | if (field.FieldType != FieldType.Enum) continue; 42 | if (field.EnumType.Values.Count <= 1) continue; 43 | field.Accessor.SetValue(message, 1); 44 | } 45 | } 46 | 47 | /// 48 | /// Create set of fidelity parameters with quality levels 49 | /// 50 | public static List FidelityMessagesWithQualityLevels() 51 | { 52 | var messages = new List(); 53 | for (int i = 0; i < QualitySettings.names.Length; ++i) 54 | { 55 | var message = FidelityBuilder.builder.CreateNew(); 56 | AdjustEnumValues(message); 57 | PerformanceTuner.MessageUtil.SetQualityLevel(message, i); 58 | messages.Add(message); 59 | } 60 | 61 | return messages; 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /Editor/Scripts/MessageUtil.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3950260a9bf049a4b758fdadac7dd9b9 3 | timeCreated: 1576262165 -------------------------------------------------------------------------------- /Editor/Scripts/Names.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | 22 | namespace Google.Android.PerformanceTuner.Editor 23 | { 24 | /// 25 | /// Common names across the plugin. 26 | /// 27 | public static class Names 28 | { 29 | public const string sceneEnumName = "Scene"; 30 | public const string loadingStateEnumName = "LoadingState"; 31 | public const string sceneFieldName = "scene"; 32 | public const string loadingStateFieldName = "loading_state"; 33 | 34 | public const string removeLoadingStateTooltip = 35 | "This parameter is obsolete. You should remove it from annotation and use \"StartRecordingLoadingTime\" " + 36 | "and \"StopRecordingLoadingTime\" instead."; 37 | 38 | public const string fixDefaultAnnotationMessage = 39 | "Loading state field in Annotation is deprecated." + 40 | "You should not use it any longer. \n" + 41 | "Use \"StartRecordingLoadingTime\" and \"StopRecordingLoadingTime\" instead. \n" + 42 | "Press \"Fix\" to remove loading state from default annotation. \n" + 43 | "Important: please remove any references to LoadingState from your project, you might get a compilier error " + 44 | "\" CS0117: 'Annotation' does not contain a definition for 'LoadingState'\" otherwise."; 45 | 46 | public const string fixDefaultAnnotationConsoleMessage = 47 | "Loading state field in Annotation is deprecated." + 48 | "You should not use it any longer. " + 49 | "Use \"StartRecordingLoadingTime\" and \"StopRecordingLoadingTime\" instead. " + 50 | "Go to \"Android Performance Tuner -> Setup -> Annotation parameters\" to fix it"; 51 | } 52 | } -------------------------------------------------------------------------------- /Editor/Scripts/Names.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 24196de50df94b15989266faf653ad64 3 | timeCreated: 1578409579 -------------------------------------------------------------------------------- /Editor/Scripts/NewEnumWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d1450435723f4bddb1c3ea1fbf5982a 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/Notification.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using UnityEditor; 22 | using UnityEngine; 23 | 24 | namespace Google.Android.PerformanceTuner.Editor 25 | { 26 | public class Notification : EditorWindow 27 | { 28 | public static void Show(string title, string body) 29 | { 30 | var window = CreateInstance(); 31 | window.titleContent = new GUIContent(title); 32 | window.position = new Rect(Screen.width / 2f, Screen.height / 2f, 400, 200); 33 | window.m_Body = body; 34 | window.ShowUtility(); 35 | } 36 | 37 | string m_Body; 38 | 39 | void OnGUI() 40 | { 41 | GUILayout.Space(10); 42 | GUILayout.Label(m_Body, EditorStyles.wordWrappedLabel); 43 | if (GUILayout.Button("Ok")) Close(); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Editor/Scripts/Notification.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddc37a426f1f448abdbf5639b03accb5 3 | timeCreated: 1577979512 -------------------------------------------------------------------------------- /Editor/Scripts/Paths.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 466b338437ff44b9b32b7bdd4bda9c47 3 | timeCreated: 1576602608 -------------------------------------------------------------------------------- /Editor/Scripts/PostGenerateGradle.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using UnityEditor.Android; 22 | using UnityEngine; 23 | 24 | namespace Google.Android.PerformanceTuner.Editor 25 | { 26 | #if UNITY_2018_2_OR_NEWER 27 | /// 28 | /// PostGenerateGradle. 29 | /// Only available for version 2018.2 or newer. 30 | /// For previous versions tuningfork files will be saved immediately to StreamingAssets. 31 | /// 32 | public class PostGenerateGradle : IPostGenerateGradleAndroidProject 33 | { 34 | public int callbackOrder 35 | { 36 | get { return 100; } 37 | } 38 | 39 | /// 40 | /// Create default fidelity messages with quality settings if default mode is enabled. 41 | /// 42 | /// path to android project 43 | public void OnPostGenerateGradleAndroidProject(string path) 44 | { 45 | var setupConfig = FileUtil.LoadSetupConfig(); 46 | if (setupConfig.pluginEnabled) 47 | { 48 | Debug.Log("Android Performance Tuner is enabled, copying files to android project..."); 49 | FileUtil.CopyTuningforkFilesToAndroidProject(path); 50 | if (!setupConfig.useAdvancedFidelityParameters) 51 | { 52 | Debug.Log("Android Performance Tuner is using default fidelity parameters, generating default quality levels..."); 53 | FileUtil.SaveFidelityMessagesInApk(path, MessageUtil.FidelityMessagesWithQualityLevels()); 54 | } 55 | } 56 | } 57 | } 58 | #endif 59 | } -------------------------------------------------------------------------------- /Editor/Scripts/PostGenerateGradle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: de017d4df7ef64ec885441c1c2cab791 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/PredictionSettingsEditor.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2023 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using UnityEditor; 23 | using UnityEngine; 24 | 25 | namespace Google.Android.PerformanceTuner.Editor 26 | { 27 | public class PredictionSettingsEditor 28 | { 29 | readonly ProjectData m_ProjectData; 30 | readonly EditorState m_EditorState; 31 | readonly EditorStatePrefs m_EditorStatePrefs; 32 | private readonly SetupConfig m_SetupConfig; 33 | 34 | const string k_DefaultInfo = 35 | " Quality level prediction API may be used.\n" + 36 | " Make sure that Application.TargetFrameRate is set to the required value."; 37 | 38 | const string k_AdvancedInfoHeader = 39 | "When using Advanced fidelity paramaters, you can call the predictability API to fetch expected framerates for each quality level.\n"; 40 | const string k_AdvancedAPIInfo = "public Result>> GetQualityLevelPredictions(UInt32 timeoutMs) \n"; 41 | const string k_AdvancedInfoAPIUsage = 42 | "The call can be made on your performance tuner instance as the following :\n"; 43 | const string k_AdvancedIntegration = "var output = tuner.GetQualityLevelPredictions(timeoutMS);\n"; 44 | const string k_AdvancedInfoAPIreturn = 45 | "Then the output.errorCode holds the error code from the API call, it will be ErrorCode.Ok on success.\n" + 46 | "output.value is a list of a tuple {fidelity, predictedTimeUs} where fidelity is the fidelity message for a quality level and predictedTimeUs is the predicted time in micro seconds for that level. \n" + 47 | "You can iterate through all the levels and pick one that has the predicted frame time close to your expected frame time. \n \n" + 48 | "The levels can be iterated in the following way :\n"; 49 | const string k_AdvancedInfoIteration = 50 | "for (int i = 0; i < output.value.Count; i++)\n" + 51 | "{ \n" + 52 | "\t //output.value[i].predictedTimeUs is the frame time for level i \n" + 53 | "\t //output.value[i].fidelity is the fidelity parameter message \n" + 54 | "}"; 55 | 56 | public PredictionSettingsEditor(ProjectData projectData, SetupConfig setupConfig) 57 | { 58 | m_ProjectData = projectData; 59 | m_SetupConfig = setupConfig; 60 | m_EditorStatePrefs = new EditorStatePrefs("prediction-settings", new EditorState() 61 | { 62 | enableDefault = m_SetupConfig.defaultPredictionEnabled 63 | }); 64 | m_EditorState = m_EditorStatePrefs.Get(); 65 | } 66 | 67 | public void OnGUI() 68 | { 69 | // All elements in the tuningfork plugin have an offset of 15 from the top. 70 | GUILayout.Space(15); 71 | 72 | if (!m_SetupConfig.useAdvancedFidelityParameters) 73 | { 74 | ShowDefaultSettings(); 75 | EditorGUI.indentLevel++; 76 | using (var group = new EditorGUI.ChangeCheckScope()) 77 | { 78 | m_EditorState.enableDefault = GUILayout.Toggle(m_EditorState.enableDefault, " Enable Prediction API(alpha)"); 79 | 80 | if (group.changed) 81 | { 82 | setDefaultSettings(m_EditorState.enableDefault); 83 | } 84 | } 85 | EditorGUI.indentLevel--; 86 | } 87 | else 88 | { 89 | // Reset previously set default enable option 90 | setDefaultSettings(false); 91 | ShowAdvancedIntegration(); 92 | } 93 | } 94 | 95 | void ShowDefaultSettings() 96 | { 97 | EditorGUILayout.LabelField(k_DefaultInfo, EditorStyles.wordWrappedLabel, GUILayout.ExpandWidth(true)); 98 | } 99 | 100 | void ShowAdvancedIntegration() 101 | { 102 | GUIStyle m_CodeStyle = new GUIStyle(GUI.skin.label) 103 | { 104 | alignment = TextAnchor.MiddleLeft, 105 | fontStyle = FontStyle.BoldAndItalic 106 | }; 107 | EditorGUILayout.LabelField(k_AdvancedInfoHeader, EditorStyles.wordWrappedLabel, GUILayout.ExpandWidth(true)); 108 | GUILayout.Box(k_AdvancedAPIInfo, m_CodeStyle); 109 | EditorGUILayout.LabelField(k_AdvancedInfoAPIUsage, EditorStyles.wordWrappedLabel, GUILayout.ExpandWidth(true)); 110 | GUILayout.Box(k_AdvancedIntegration, m_CodeStyle); 111 | EditorGUILayout.LabelField(k_AdvancedInfoAPIreturn, EditorStyles.wordWrappedLabel, GUILayout.ExpandWidth(true)); 112 | GUILayout.Box(k_AdvancedInfoIteration, m_CodeStyle); 113 | } 114 | 115 | void setDefaultSettings(bool enable) 116 | { 117 | m_EditorState.enableDefault = enable; 118 | m_SetupConfig.SetDefaultPredictions(m_EditorState.enableDefault); 119 | m_EditorStatePrefs.Set(m_EditorState); 120 | EditorUtility.SetDirty(m_SetupConfig); 121 | } 122 | 123 | [Serializable] 124 | public class EditorState 125 | { 126 | public bool enableDefault; 127 | } 128 | 129 | } 130 | } -------------------------------------------------------------------------------- /Editor/Scripts/PredictionSettingsEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1cd5d8c41f905a468aeb0f6b30077e7 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/ProjectData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01a334edea7da4d49a10c6f836442185 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/Proto.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 821489e5ac3f84252864a6a7935209da 3 | timeCreated: 1576238350 -------------------------------------------------------------------------------- /Editor/Scripts/Proto/EnumInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using UnityEngine; 24 | 25 | namespace Google.Android.PerformanceTuner.Editor.Proto 26 | { 27 | /// 28 | /// Class to keep information about proto enum. 29 | /// Used to describe and generate proto files. 30 | /// 31 | [Serializable] 32 | public struct EnumInfo 33 | { 34 | const string k_InvalidValue = "INVALID"; 35 | public string name; 36 | public List values; 37 | 38 | /// 39 | /// Convert EnumInfo into a string formatted as it should appear in .proto file. 40 | /// 41 | public string ToProtoString(SetupConfig setupConfig) 42 | { 43 | AddInvalidValue(); 44 | var str = "\nenum " + name + " {\n"; 45 | for (var i = 0; i < values.Count; ++i) 46 | str += string.Format(" {0}_{1} = {2};\n", name.ToUpper(), values[i].ToUpper(), i); 47 | 48 | #if APT_ADDRESSABLE_PACKAGE_PRESENT 49 | if(setupConfig != null && name.ToUpper().Equals("SCENE") && setupConfig.AreAddressablesScenesPresent()){ 50 | for (var i = 0; i < setupConfig.AddressablesScenes.Count; ++i) 51 | str += string.Format(" {0}_{1} = {2};\n", name.ToUpper(), setupConfig.AddressablesScenes[i].protoEnumSceneName, setupConfig.AddressablesScenes[i].value); 52 | } 53 | #endif 54 | str += "}\n"; 55 | return str; 56 | } 57 | 58 | /// 59 | /// 0-index element should always be *enum_name*_Invalid value. 60 | /// 61 | void AddInvalidValue() 62 | { 63 | if (values.Count == 0 || !values[0].Equals(k_InvalidValue, StringComparison.OrdinalIgnoreCase)) 64 | values.Insert(0, k_InvalidValue); 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /Editor/Scripts/Proto/EnumInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3c5e1a1b62714da8964ce871bd688a31 3 | timeCreated: 1576238357 -------------------------------------------------------------------------------- /Editor/Scripts/Proto/EnumInfoHelper.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Collections.Generic; 22 | using System.IO; 23 | using System.Linq; 24 | using System.Text.RegularExpressions; 25 | using Google.Protobuf.Reflection; 26 | using UnityEditor; 27 | 28 | namespace Google.Android.PerformanceTuner.Editor.Proto 29 | { 30 | /// 31 | /// Helper to manipulate enums being declared in the Tuning Fork generated proto. 32 | /// 33 | public class EnumInfoHelper 34 | { 35 | public static readonly string[] reservedEnumNames = {Names.sceneEnumName}; 36 | 37 | readonly IList m_EnumTypes; 38 | 39 | public EnumInfoHelper(FileDescriptor fileDescriptor) 40 | { 41 | m_EnumTypes = fileDescriptor.EnumTypes; 42 | } 43 | 44 | public List GetAllNames() 45 | { 46 | return m_EnumTypes.Select(x => x.Name).ToList(); 47 | } 48 | 49 | public IEnumerable GetAllEditableNames() 50 | { 51 | return m_EnumTypes.Select(x => x.Name).Where(x => !reservedEnumNames.Contains(x)); 52 | } 53 | 54 | public List CreateInfoList() 55 | { 56 | var enums = new List(); 57 | foreach (var enumType in m_EnumTypes) 58 | { 59 | var prefix = enumType.Name + "_"; 60 | var prefixSize = prefix.Length; 61 | var info = new EnumInfo 62 | { 63 | name = enumType.Name, 64 | values = enumType.Values.Select(enumValue => enumValue.Name.Substring(prefixSize)).ToList() 65 | }; 66 | enums.Add(info); 67 | } 68 | 69 | return enums; 70 | } 71 | 72 | public EnumInfo? GetInfo(string name) 73 | { 74 | EnumDescriptor enumType = m_EnumTypes.FirstOrDefault(x => x.Name == name); 75 | if (enumType == null) return null; 76 | var prefix = enumType.Name + "_"; 77 | var prefixSize = prefix.Length; 78 | return new EnumInfo 79 | { 80 | name = enumType.Name, 81 | values = enumType.Values.Select(enumValue => enumValue.Name.Substring(prefixSize)).ToList() 82 | }; 83 | } 84 | 85 | public static EnumInfo GetSceneEnum(EditorBuildSettingsScene[] scenes) 86 | { 87 | var info = new EnumInfo 88 | { 89 | name = Names.sceneEnumName, 90 | values = new List() 91 | }; 92 | 93 | foreach (var scene in scenes) 94 | { 95 | // Scene could be deleted, skip them 96 | if (scene == null || string.IsNullOrEmpty(scene.path) || !scene.enabled) continue; 97 | var sceneName = AddressablesScenesEnumInfo.ConvertScenePathToProtoEnumEntry(scene.path, false); 98 | 99 | info.values.Add(sceneName); 100 | } 101 | 102 | return info; 103 | } 104 | } 105 | } -------------------------------------------------------------------------------- /Editor/Scripts/Proto/EnumInfoHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2efe74ef65a1426283ec1965fd933167 3 | timeCreated: 1576240182 -------------------------------------------------------------------------------- /Editor/Scripts/Proto/FieldInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using Google.Protobuf.Reflection; 23 | 24 | namespace Google.Android.PerformanceTuner.Editor.Proto 25 | { 26 | /// 27 | /// Class to keep information about proto field. 28 | /// Used to describe and generate proto files. 29 | /// 30 | [Serializable] 31 | public struct FieldInfo 32 | { 33 | const string k_DefaultFieldName = "new_field_"; 34 | 35 | /// 36 | /// Construct a FieldInfo with the default values for a field. 37 | /// FidelityParameters message's field has default Int32 type. 38 | /// Annotation message's field has default Enum type. 39 | /// 40 | public FieldInfo(FileDescriptor fileDescriptor, ProtoMessageType type, int index) 41 | { 42 | name = k_DefaultFieldName + index; 43 | enumTypeIndex = 0; 44 | 45 | // Only enums are allowed for annotations. 46 | if (type == ProtoMessageType.Annotation) 47 | { 48 | fieldType = FieldType.Enum; 49 | enumType = fileDescriptor.EnumTypes[enumTypeIndex].Name; 50 | } 51 | else 52 | { 53 | fieldType = FieldType.Int32; 54 | enumType = null; 55 | } 56 | } 57 | 58 | public enum FieldType 59 | { 60 | Int32 = 0, 61 | Float = 1, 62 | Enum = 2 63 | } 64 | 65 | public string name; 66 | public FieldType fieldType; 67 | public string enumType; 68 | public int enumTypeIndex; 69 | } 70 | } -------------------------------------------------------------------------------- /Editor/Scripts/Proto/FieldInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3dfb25ec826477196f8a18fe6a6eeb8 3 | timeCreated: 1576256137 -------------------------------------------------------------------------------- /Editor/Scripts/Proto/FileInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using Google.Protobuf.Reflection; 24 | 25 | namespace Google.Android.PerformanceTuner.Editor.Proto 26 | { 27 | /// 28 | /// Class to keep information about a proto file. 29 | /// Includes information about enums and messages. 30 | /// Used to describe and generate proto files. 31 | /// 32 | [Serializable] 33 | public class FileInfo 34 | { 35 | string m_Comment = string.Empty; 36 | 37 | const string k_DefaultOptions = 38 | "syntax = \"proto3\";\n\n" + 39 | "option csharp_namespace = \"{0}\";\n"; 40 | 41 | string m_CSharpNamespace = "Google.Android.PerformanceTuner"; 42 | 43 | readonly Dictionary m_Enums = new Dictionary(); 44 | readonly Dictionary m_Messages = new Dictionary(); 45 | 46 | /// 47 | /// Create FileInfo from FileDescriptor. 48 | /// It includes information for each message and enum in FileDescriptor. 49 | /// 50 | /// FileDescriptor to parse messages and enums from 51 | public FileInfo(FileDescriptor fileDescriptor) 52 | { 53 | EnumInfoHelper enumHelper = new EnumInfoHelper(fileDescriptor); 54 | AddEnums(enumHelper.CreateInfoList()); 55 | foreach (var messageType in fileDescriptor.MessageTypes) 56 | { 57 | AddMessage(new MessageInfo(messageType)); 58 | } 59 | } 60 | 61 | public void SetNamespace(string cSharpNamespace) 62 | { 63 | m_CSharpNamespace = cSharpNamespace; 64 | } 65 | 66 | public void SetComment(string comment) 67 | { 68 | m_Comment = comment; 69 | } 70 | 71 | /// 72 | /// Action called every time there are changes in messages or enums. 73 | /// 74 | public Action onUpdate; 75 | 76 | public void AddMessage(MessageInfo message) 77 | { 78 | m_Messages[message.name] = message; 79 | if (onUpdate != null) 80 | onUpdate(); 81 | } 82 | 83 | void AddEnums(IEnumerable enums) 84 | { 85 | foreach (var enumInfo in enums) 86 | m_Enums[enumInfo.name] = enumInfo; 87 | if (onUpdate != null) 88 | onUpdate(); 89 | } 90 | 91 | public void AddEnum(EnumInfo enumInfo) 92 | { 93 | m_Enums[enumInfo.name] = enumInfo; 94 | if (onUpdate != null) 95 | onUpdate(); 96 | } 97 | 98 | public void DeleteEnum(string enumType) 99 | { 100 | if (m_Enums.ContainsKey(enumType)) 101 | m_Enums.Remove(enumType); 102 | foreach (var message in m_Messages.Values) 103 | message.RemoveEnum(enumType); 104 | if (onUpdate != null) 105 | onUpdate(); 106 | } 107 | 108 | 109 | /// 110 | /// Convert FileInfo into string formatted as it should appear in proto file. 111 | /// 112 | public string ToProtoString(SetupConfig setupConfig) 113 | { 114 | string protoStr = String.Empty; 115 | if (m_Comment != string.Empty) 116 | protoStr += string.Format("// {0}\n", m_Comment); 117 | protoStr += string.Format(k_DefaultOptions, m_CSharpNamespace); 118 | foreach (var info in m_Enums.Values) 119 | protoStr += info.ToProtoString(setupConfig); 120 | foreach (var message in m_Messages.Values) 121 | protoStr += message.ToProtoString(); 122 | return protoStr; 123 | } 124 | } 125 | } -------------------------------------------------------------------------------- /Editor/Scripts/Proto/FileInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcbcb817f7904316987f11b47ec1ff95 3 | timeCreated: 1576502202 -------------------------------------------------------------------------------- /Editor/Scripts/Proto/MessageInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using Google.Protobuf.Reflection; 25 | 26 | namespace Google.Android.PerformanceTuner.Editor.Proto 27 | { 28 | /// 29 | /// Class to keep information about a proto message. 30 | /// Used to describe and generate proto files. 31 | /// 32 | [Serializable] 33 | public class MessageInfo 34 | { 35 | const int k_FirstFieldIndex = 1; 36 | public List fields = new List(); 37 | public string name; 38 | 39 | public MessageInfo() 40 | { 41 | } 42 | 43 | public MessageInfo(MessageInfo other) 44 | { 45 | name = other.name; 46 | fields = new List(other.fields); 47 | } 48 | 49 | /// 50 | /// Create MessageInfo from MessageDescriptor. 51 | /// Each field in descriptor is mapped to field info. 52 | /// Only three types of fields are supported - int32, float and enum. 53 | /// 54 | /// MessageDescriptor to parse fields from 55 | /// throw Exception if field type is not suuported 56 | public MessageInfo(MessageDescriptor messageDescriptor) 57 | { 58 | name = messageDescriptor.Name; 59 | fields = new List(); 60 | foreach (var field in messageDescriptor.Fields.InDeclarationOrder()) 61 | { 62 | var info = new FieldInfo {name = field.Name}; 63 | switch (field.FieldType) 64 | { 65 | case FieldType.Enum: 66 | info.enumType = field.EnumType.Name; 67 | info.fieldType = FieldInfo.FieldType.Enum; 68 | info.enumTypeIndex = field.EnumType.Index; 69 | break; 70 | case FieldType.Int32: 71 | info.enumType = string.Empty; 72 | info.fieldType = FieldInfo.FieldType.Int32; 73 | break; 74 | case FieldType.Float: 75 | info.enumType = string.Empty; 76 | info.fieldType = FieldInfo.FieldType.Float; 77 | break; 78 | default: 79 | throw new Exception("Field type is not supported"); 80 | } 81 | 82 | fields.Add(info); 83 | } 84 | } 85 | 86 | public void RemoveEnum(string enumType) 87 | { 88 | fields = fields.Where(field => field.enumType != enumType).ToList(); 89 | } 90 | 91 | /// 92 | /// Convert MessageInfo into string formatted as it should appear in .proto file. 93 | /// 94 | public string ToProtoString() 95 | { 96 | var str = "\nmessage " + name + " {\n"; 97 | var index = k_FirstFieldIndex; 98 | foreach (var info in fields) 99 | { 100 | string typeName; 101 | if (info.fieldType == FieldInfo.FieldType.Enum) typeName = info.enumType; 102 | else typeName = info.fieldType.ToString().ToLower(); 103 | str += string.Format(" {0} {1} = {2};\n", typeName, info.name, index); 104 | index++; 105 | } 106 | 107 | str += "}\n"; 108 | return str; 109 | } 110 | } 111 | } -------------------------------------------------------------------------------- /Editor/Scripts/Proto/MessageInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd1db6c159e442368bd003be3ad3794f 3 | timeCreated: 1576501929 -------------------------------------------------------------------------------- /Editor/Scripts/ProtocCompiler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5bd81b580b1e041f98dceb17f693a6d8 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/ResetAddressablesWindow.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2022 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using UnityEditor; 22 | using UnityEngine; 23 | 24 | namespace Google.Android.PerformanceTuner.Editor 25 | { 26 | public class ResetAddressablesWindow : EditorWindow 27 | { 28 | #if APT_ADDRESSABLE_PACKAGE_PRESENT 29 | private readonly string warningMessage = "Are you sure you want to reset the Addressables Scenes?\n" + 30 | "This operation can NOT be undone and will destroy all the current " + 31 | "bindings between scenes and protobuf values."; 32 | 33 | private readonly string cancelButton = "Cancel"; 34 | private readonly string resetButton = "Reset"; 35 | #endif 36 | SetupConfig setupConfig; 37 | 38 | public static void ShowWindow(SetupConfig config) 39 | { 40 | var window = ScriptableObject.CreateInstance(); 41 | window.titleContent = new GUIContent("Reset Addressables Scenes"); 42 | window.position = new Rect(Screen.width / 2f, Screen.height / 2f, 400, 200); 43 | window.setupConfig = config; 44 | window.ShowUtility(); 45 | } 46 | 47 | void OnGUI() 48 | { 49 | #if APT_ADDRESSABLE_PACKAGE_PRESENT 50 | EditorGUILayout.HelpBox(warningMessage, MessageType.Warning); 51 | GUILayout.BeginHorizontal(); 52 | if (GUILayout.Button(cancelButton)) 53 | { 54 | Close(); 55 | return; 56 | } 57 | GUILayout.Space(20); 58 | if (GUILayout.Button(resetButton) && setupConfig) 59 | { 60 | setupConfig.ResetAddressablesScenes(); 61 | Close(); 62 | } 63 | #endif 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /Editor/Scripts/ResetAddressablesWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af5112dbf9838413583eec98eeaea464 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/SettingsEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 03d6d93e504784c0fb671635df61579e 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/SettingsUtil.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Collections.Generic; 22 | 23 | namespace Google.Android.PerformanceTuner.Editor 24 | { 25 | public class SettingsUtil 26 | { 27 | // TODO(b/120588304): Add unity frame buckets. 28 | static readonly List k_DefaultHistograms = 29 | new List() 30 | { 31 | new Settings.Types.Histogram() 32 | { 33 | InstrumentKey = (int) InstrumentationKeys.RawFrameTime, 34 | BucketMin = 6.54f, 35 | BucketMax = 60f, 36 | NBuckets = 200, 37 | }, 38 | new Settings.Types.Histogram() 39 | { 40 | InstrumentKey = (int) InstrumentationKeys.PacedFrameTime, 41 | BucketMin = 10, 42 | BucketMax = 40, 43 | NBuckets = 30, 44 | }, 45 | new Settings.Types.Histogram() 46 | { 47 | InstrumentKey = (int) InstrumentationKeys.GpuTime, 48 | BucketMin = 0, 49 | BucketMax = 20, 50 | NBuckets = 30, 51 | }, 52 | new Settings.Types.Histogram() 53 | { 54 | InstrumentKey = (int) InstrumentationKeys.CpuTime, 55 | BucketMin = 0, 56 | BucketMax = 20, 57 | NBuckets = 30, 58 | } 59 | }; 60 | 61 | static readonly Settings.Types.AggregationStrategy k_DefaultAggregation = 62 | new Settings.Types.AggregationStrategy() 63 | { 64 | IntervalmsOrCount = 600000, /* 10 minutes */ 65 | Method = Settings.Types.AggregationStrategy.Types.Submission.TimeBased 66 | }; 67 | 68 | /// 69 | /// Settings message with default aggregation and histograms. 70 | /// 71 | public static readonly Settings defaultSettings = new Settings() 72 | { 73 | AggregationStrategy = k_DefaultAggregation, 74 | Histograms = {k_DefaultHistograms} 75 | }; 76 | 77 | /// 78 | /// Always merge these settings into saved settings. 79 | /// 80 | static readonly Settings k_SettingsToMerge = new Settings() 81 | { 82 | BaseUri = "https://performanceparameters.googleapis.com/v1/", 83 | InitialRequestTimeoutMs = 1000, 84 | UltimateRequestTimeoutMs = 100000, 85 | }; 86 | 87 | /// 88 | /// Adjust Settings to match information from proto descriptor. 89 | /// 90 | /// 91 | public static Settings DefaultAdjustFunction(Settings settings, DevDescriptor devDescriptor) 92 | { 93 | settings.AggregationStrategy.AnnotationEnumSize.Clear(); 94 | settings.AggregationStrategy.AnnotationEnumSize.AddRange(devDescriptor.annotationEnumSizes); 95 | settings.AggregationStrategy.MaxInstrumentationKeys = settings.Histograms.Count; 96 | settings.LevelAnnotationIndex = devDescriptor.sceneAnnotationIndex; 97 | settings.LoadingAnnotationIndex = devDescriptor.loadingAnnotationIndex; 98 | settings.MergeFrom(k_SettingsToMerge); 99 | return settings; 100 | } 101 | } 102 | } -------------------------------------------------------------------------------- /Editor/Scripts/SettingsUtil.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c445511645de4d138e734c2d26e4706e 3 | timeCreated: 1576769730 -------------------------------------------------------------------------------- /Editor/Scripts/Styles.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using UnityEditor; 22 | using UnityEngine; 23 | 24 | namespace Google.Android.PerformanceTuner.Editor 25 | { 26 | /// 27 | /// Common styles across the plugin. 28 | /// 29 | public class Styles 30 | { 31 | const int k_ButtonWidthMargin = 10; 32 | public static GUIStyle button { get; private set; } 33 | public static GUIStyle info { get; private set; } 34 | public static GUIStyle richWordWrappedLabel { get; private set; } 35 | public static GUIStyle warningLabel { get; private set; } 36 | 37 | 38 | static bool s_Inited = false; 39 | 40 | /// 41 | /// Init all styles. 42 | /// Call it in OnGUI. 43 | /// 44 | public static void InitAllStyles() 45 | { 46 | if (s_Inited) return; 47 | s_Inited = true; 48 | button = CreateButtonStyle(); 49 | info = CreateInfoStyle(); 50 | richWordWrappedLabel = CreateRichWrappedLabel(); 51 | warningLabel = CreateWarningLabelStyle(); 52 | } 53 | 54 | static GUIStyle CreateInfoStyle() 55 | { 56 | return new GUIStyle(EditorStyles.wordWrappedLabel) {fontSize = 11}; 57 | } 58 | 59 | static GUIStyle CreateButtonStyle() 60 | { 61 | var padding = new RectOffset(k_ButtonWidthMargin, k_ButtonWidthMargin, GUI.skin.button.padding.top, 62 | GUI.skin.button.padding.bottom); 63 | return new GUIStyle(GUI.skin.button) {padding = padding}; 64 | } 65 | 66 | static GUIStyle CreateWarningLabelStyle() 67 | { 68 | var style = new GUIStyle(EditorStyles.wordWrappedLabel) {richText = true}; 69 | style.normal.textColor = Color.red; 70 | return style; 71 | } 72 | 73 | static GUIStyle CreateRichWrappedLabel() 74 | { 75 | return new GUIStyle(EditorStyles.wordWrappedLabel) {richText = true}; 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /Editor/Scripts/Styles.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e01390130cbc48f78fb8eb4ec9daff40 3 | timeCreated: 1578568532 -------------------------------------------------------------------------------- /Editor/Scripts/Trend.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Google.Android.PerformanceTuner.Editor 22 | { 23 | public enum Trend 24 | { 25 | Invalid, 26 | Flat, 27 | Up, 28 | Down, 29 | } 30 | } -------------------------------------------------------------------------------- /Editor/Scripts/Trend.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3cf03ee473f9f49a8860999563049df6 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/TrendHelper.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Google.Android.PerformanceTuner.Editor 22 | { 23 | using System; 24 | using UnityEngine; 25 | using System.Linq; 26 | using System.Collections.Generic; 27 | using Google.Protobuf; 28 | using Google.Protobuf.Reflection; 29 | 30 | public class TrendHelper 31 | { 32 | public TrendHelper() 33 | { 34 | foreach (var icon in k_IconNames) 35 | icons.Add(icon.Key, new GUIContent((Texture) Resources.Load(icon.Value))); 36 | } 37 | 38 | public readonly Dictionary icons = new Dictionary(); 39 | 40 | readonly Dictionary k_IconNames = new Dictionary() 41 | { 42 | {Trend.Invalid, "ic_error_outline"}, 43 | {Trend.Flat, "ic_trending_flat"}, 44 | {Trend.Down, "ic_trending_down"}, 45 | {Trend.Up, "ic_trending_up"} 46 | }; 47 | 48 | public static Trend FindTrend(IEnumerable messages, FieldDescriptor field) 49 | { 50 | object prevValue = null; 51 | var trend = Trend.Flat; 52 | foreach (var message in messages) 53 | { 54 | field.Accessor.GetValue(message); 55 | object value = field.Accessor.GetValue(message); 56 | trend = MergeTrends(trend, FindTrend(prevValue, value)); 57 | prevValue = value; 58 | } 59 | 60 | return trend; 61 | } 62 | 63 | static Trend MergeTrends(params Trend[] trends) 64 | { 65 | if (trends.Contains(Trend.Invalid)) 66 | return Trend.Invalid; 67 | if (trends.Contains(Trend.Down) && trends.Contains(Trend.Up)) 68 | return Trend.Invalid; 69 | if (trends.Contains(Trend.Down)) return Trend.Down; 70 | if (trends.Contains(Trend.Up)) return Trend.Up; 71 | return Trend.Flat; 72 | } 73 | 74 | static Trend FindTrend(object prevValue, object nextValue) 75 | { 76 | if (prevValue == null) return Trend.Flat; 77 | 78 | if (prevValue.GetType() != nextValue.GetType()) 79 | throw new ArgumentException("Can not find trend, values have different types"); 80 | 81 | if (nextValue is int) 82 | { 83 | if ((int) prevValue < (int) nextValue) return Trend.Up; 84 | if ((int) prevValue > (int) nextValue) return Trend.Down; 85 | return Trend.Flat; 86 | } 87 | 88 | if (nextValue is float) 89 | { 90 | if ((float) prevValue < (float) nextValue) return Trend.Up; 91 | if ((float) prevValue > (float) nextValue) return Trend.Down; 92 | return Trend.Flat; 93 | } 94 | 95 | if (nextValue is Enum) 96 | { 97 | if ((int) prevValue < (int) nextValue) return Trend.Up; 98 | if ((int) prevValue > (int) nextValue) return Trend.Down; 99 | return Trend.Flat; 100 | } 101 | 102 | throw new ArgumentException("Can not find trend, unsupported values type"); 103 | } 104 | } 105 | } -------------------------------------------------------------------------------- /Editor/Scripts/TrendHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 799d241074a3640da8771dd21f1b5951 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0fb341d84c7bf4838b66c0b4ede33f1c 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android Performance Tuner Unity plugin 2 | Copyright 2020 Google LLC. All rights reserved. 3 | 4 | Android Performance Tuner is a library to help developers measure frame rendering time across different devices and game stages. This plugin will help developers integrate Android Performance Tuner into their game. 5 | 6 | ## Quick Start 7 | 8 | See the [Getting Started with Unity](https://developer.android.com/games/sdk/performance-tuner/unity) developer guide. 9 | 10 | ## API Reference 11 | 12 | See the [Android Performance Tuner for Unity API Reference](https://developer.android.com/games/sdk/reference/performance-tuner/unity). 13 | 14 | ## Release Notes 15 | 16 | The release notes are available on the [releases page](https://github.com/android/tuningfork/releases). 17 | 18 | # Terms & Conditions 19 | By downloading the Android Performance Tuner Unity Plugin, you agree to [Terms and Conditions](https://developer.android.com/studio/terms). -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40c146e83835b431692682ba55c6e4a6 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e4c3301db35314c4387d08eea160abed 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Google.Android.PerformanceTuner.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Google.Android.PerformanceTuner", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:9e24947de15b9834991c9d8411ea37cf", 6 | "GUID:69448af7b92c7f342b298e06a37122aa" 7 | ], 8 | "includePlatforms": [], 9 | "excludePlatforms": [], 10 | "allowUnsafeCode": false, 11 | "overrideReferences": true, 12 | "precompiledReferences": [ 13 | "Google.Protobuf.dll" 14 | ], 15 | "autoReferenced": true, 16 | "defineConstraints": [], 17 | "versionDefines": [ 18 | { 19 | "name": "com.unity.addressables", 20 | "expression": "1.19.4", 21 | "define": "APT_ADDRESSABLE_PACKAGE_PRESENT" 22 | } 23 | ], 24 | "noEngineReferences": false 25 | } -------------------------------------------------------------------------------- /Runtime/Google.Android.PerformanceTuner.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7a57b0b1da1874616a015193262d95af 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6760cb562274d4eeb81c6f13cd5f66d4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Plugins/Android.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b52a681022aa6413ba2748d772c0fe2b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Plugins/Android/Google.Protobuf.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Runtime/Plugins/Android/Google.Protobuf.dll -------------------------------------------------------------------------------- /Runtime/Plugins/Android/Google.Protobuf.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b99565c164114a4a88ce838efe9c7a4 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /Runtime/Plugins/Android/arm64-v8a.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bbdc0ee2469b842f78a8fc234ce30361 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Plugins/Android/arm64-v8a/libc++_shared.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Runtime/Plugins/Android/arm64-v8a/libc++_shared.so -------------------------------------------------------------------------------- /Runtime/Plugins/Android/arm64-v8a/libc++_shared.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bfc9f7434f9d4f541b3e3a42ddd36f45 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | : Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Android: 0 20 | Exclude Editor: 1 21 | Exclude Linux64: 1 22 | Exclude OSXUniversal: 1 23 | Exclude Win: 1 24 | Exclude Win64: 1 25 | - first: 26 | Android: Android 27 | second: 28 | enabled: 1 29 | settings: 30 | CPU: ARM64 31 | - first: 32 | Any: 33 | second: 34 | enabled: 0 35 | settings: {} 36 | - first: 37 | Editor: Editor 38 | second: 39 | enabled: 0 40 | settings: 41 | CPU: AnyCPU 42 | DefaultValueInitialized: true 43 | OS: AnyOS 44 | - first: 45 | Facebook: Win 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Facebook: Win64 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: AnyCPU 56 | - first: 57 | Standalone: Linux64 58 | second: 59 | enabled: 0 60 | settings: 61 | CPU: AnyCPU 62 | - first: 63 | Standalone: OSXUniversal 64 | second: 65 | enabled: 0 66 | settings: 67 | CPU: AnyCPU 68 | - first: 69 | Standalone: Win 70 | second: 71 | enabled: 0 72 | settings: 73 | CPU: AnyCPU 74 | - first: 75 | Standalone: Win64 76 | second: 77 | enabled: 0 78 | settings: 79 | CPU: AnyCPU 80 | userData: 81 | assetBundleName: 82 | assetBundleVariant: 83 | -------------------------------------------------------------------------------- /Runtime/Plugins/Android/arm64-v8a/libunitytuningfork.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Runtime/Plugins/Android/arm64-v8a/libunitytuningfork.so -------------------------------------------------------------------------------- /Runtime/Plugins/Android/arm64-v8a/libunitytuningfork.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 097a09ebed43e4fcbb58b682e242b574 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | : Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Android: 0 20 | Exclude Editor: 1 21 | Exclude Linux64: 1 22 | Exclude OSXUniversal: 1 23 | Exclude Win: 1 24 | Exclude Win64: 1 25 | - first: 26 | Android: Android 27 | second: 28 | enabled: 1 29 | settings: 30 | CPU: ARM64 31 | - first: 32 | Any: 33 | second: 34 | enabled: 0 35 | settings: {} 36 | - first: 37 | Editor: Editor 38 | second: 39 | enabled: 0 40 | settings: 41 | CPU: AnyCPU 42 | DefaultValueInitialized: true 43 | OS: AnyOS 44 | - first: 45 | Facebook: Win 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Facebook: Win64 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: AnyCPU 56 | - first: 57 | Standalone: Linux64 58 | second: 59 | enabled: 0 60 | settings: 61 | CPU: AnyCPU 62 | - first: 63 | Standalone: OSXUniversal 64 | second: 65 | enabled: 0 66 | settings: 67 | CPU: AnyCPU 68 | - first: 69 | Standalone: Win 70 | second: 71 | enabled: 0 72 | settings: 73 | CPU: AnyCPU 74 | - first: 75 | Standalone: Win64 76 | second: 77 | enabled: 0 78 | settings: 79 | CPU: AnyCPU 80 | userData: 81 | assetBundleName: 82 | assetBundleVariant: 83 | -------------------------------------------------------------------------------- /Runtime/Plugins/Android/armeabi-v7a.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 502f0798e279d4395bb24ecd95b98d99 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Plugins/Android/armeabi-v7a/libc++_shared.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Runtime/Plugins/Android/armeabi-v7a/libc++_shared.so -------------------------------------------------------------------------------- /Runtime/Plugins/Android/armeabi-v7a/libc++_shared.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ecaf520e1926624d928468a74e65ea9 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Android: 0 20 | Exclude Editor: 1 21 | Exclude Linux64: 1 22 | Exclude OSXUniversal: 1 23 | Exclude Win: 1 24 | Exclude Win64: 1 25 | - first: 26 | Android: Android 27 | second: 28 | enabled: 1 29 | settings: 30 | CPU: ARMv7 31 | - first: 32 | Any: 33 | second: 34 | enabled: 0 35 | settings: {} 36 | - first: 37 | Editor: Editor 38 | second: 39 | enabled: 0 40 | settings: 41 | CPU: AnyCPU 42 | DefaultValueInitialized: true 43 | OS: AnyOS 44 | - first: 45 | Facebook: Win 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Facebook: Win64 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: AnyCPU 56 | - first: 57 | Standalone: Linux64 58 | second: 59 | enabled: 0 60 | settings: 61 | CPU: AnyCPU 62 | - first: 63 | Standalone: OSXUniversal 64 | second: 65 | enabled: 0 66 | settings: 67 | CPU: AnyCPU 68 | - first: 69 | Standalone: Win 70 | second: 71 | enabled: 0 72 | settings: 73 | CPU: AnyCPU 74 | - first: 75 | Standalone: Win64 76 | second: 77 | enabled: 0 78 | settings: 79 | CPU: AnyCPU 80 | userData: 81 | assetBundleName: 82 | assetBundleVariant: 83 | -------------------------------------------------------------------------------- /Runtime/Plugins/Android/armeabi-v7a/libunitytuningfork.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Runtime/Plugins/Android/armeabi-v7a/libunitytuningfork.so -------------------------------------------------------------------------------- /Runtime/Plugins/Android/armeabi-v7a/libunitytuningfork.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f2400740265a492ea5f1b7475951d5f 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Android: 0 20 | Exclude Editor: 1 21 | Exclude Linux64: 1 22 | Exclude OSXUniversal: 1 23 | Exclude Win: 1 24 | Exclude Win64: 1 25 | - first: 26 | Android: Android 27 | second: 28 | enabled: 1 29 | settings: 30 | CPU: ARMv7 31 | - first: 32 | Any: 33 | second: 34 | enabled: 0 35 | settings: {} 36 | - first: 37 | Editor: Editor 38 | second: 39 | enabled: 0 40 | settings: 41 | CPU: AnyCPU 42 | DefaultValueInitialized: true 43 | OS: AnyOS 44 | - first: 45 | Facebook: Win 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Facebook: Win64 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: AnyCPU 56 | - first: 57 | Standalone: Linux64 58 | second: 59 | enabled: 0 60 | settings: 61 | CPU: AnyCPU 62 | - first: 63 | Standalone: OSXUniversal 64 | second: 65 | enabled: 0 66 | settings: 67 | CPU: AnyCPU 68 | - first: 69 | Standalone: Win 70 | second: 71 | enabled: 0 72 | settings: 73 | CPU: AnyCPU 74 | - first: 75 | Standalone: Win64 76 | second: 77 | enabled: 0 78 | settings: 79 | CPU: AnyCPU 80 | userData: 81 | assetBundleName: 82 | assetBundleVariant: 83 | -------------------------------------------------------------------------------- /Runtime/Plugins/Android/x86-64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d75e5591f6c849c8906479ca292f556 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Plugins/Android/x86-64/libc++_shared.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Runtime/Plugins/Android/x86-64/libc++_shared.so -------------------------------------------------------------------------------- /Runtime/Plugins/Android/x86-64/libc++_shared.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43fbba6fcf9763c4984e8c9e4f9269b1 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Android: 0 20 | Exclude Editor: 1 21 | Exclude Linux64: 1 22 | Exclude OSXUniversal: 1 23 | Exclude Win: 1 24 | Exclude Win64: 1 25 | - first: 26 | Android: Android 27 | second: 28 | enabled: 1 29 | settings: 30 | CPU: x86_64 31 | - first: 32 | Any: 33 | second: 34 | enabled: 0 35 | settings: {} 36 | - first: 37 | Editor: Editor 38 | second: 39 | enabled: 0 40 | settings: 41 | CPU: AnyCPU 42 | DefaultValueInitialized: true 43 | OS: AnyOS 44 | - first: 45 | Facebook: Win 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Facebook: Win64 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: AnyCPU 56 | - first: 57 | Standalone: Linux64 58 | second: 59 | enabled: 0 60 | settings: 61 | CPU: AnyCPU 62 | - first: 63 | Standalone: OSXUniversal 64 | second: 65 | enabled: 0 66 | settings: 67 | CPU: AnyCPU 68 | - first: 69 | Standalone: Win 70 | second: 71 | enabled: 0 72 | settings: 73 | CPU: AnyCPU 74 | - first: 75 | Standalone: Win64 76 | second: 77 | enabled: 0 78 | settings: 79 | CPU: AnyCPU 80 | userData: 81 | assetBundleName: 82 | assetBundleVariant: 83 | -------------------------------------------------------------------------------- /Runtime/Plugins/Android/x86-64/libunitytuningfork.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Runtime/Plugins/Android/x86-64/libunitytuningfork.so -------------------------------------------------------------------------------- /Runtime/Plugins/Android/x86-64/libunitytuningfork.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 964e9af4970804935b8d2b2bae87a03b 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Android: 0 20 | Exclude Editor: 1 21 | Exclude Linux64: 1 22 | Exclude OSXUniversal: 1 23 | Exclude Win: 1 24 | Exclude Win64: 1 25 | - first: 26 | Android: Android 27 | second: 28 | enabled: 1 29 | settings: 30 | CPU: x86_64 31 | - first: 32 | Any: 33 | second: 34 | enabled: 0 35 | settings: {} 36 | - first: 37 | Editor: Editor 38 | second: 39 | enabled: 0 40 | settings: 41 | CPU: AnyCPU 42 | DefaultValueInitialized: true 43 | OS: AnyOS 44 | - first: 45 | Facebook: Win 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Facebook: Win64 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: AnyCPU 56 | - first: 57 | Standalone: Linux64 58 | second: 59 | enabled: 0 60 | settings: 61 | CPU: AnyCPU 62 | - first: 63 | Standalone: OSXUniversal 64 | second: 65 | enabled: 0 66 | settings: 67 | CPU: AnyCPU 68 | - first: 69 | Standalone: Win 70 | second: 71 | enabled: 0 72 | settings: 73 | CPU: AnyCPU 74 | - first: 75 | Standalone: Win64 76 | second: 77 | enabled: 0 78 | settings: 79 | CPU: AnyCPU 80 | userData: 81 | assetBundleName: 82 | assetBundleVariant: 83 | -------------------------------------------------------------------------------- /Runtime/Plugins/Android/x86.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b9417b580e2a43ccb9b6fb42626a77a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Plugins/Android/x86/libc++_shared.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Runtime/Plugins/Android/x86/libc++_shared.so -------------------------------------------------------------------------------- /Runtime/Plugins/Android/x86/libc++_shared.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b95600188438b7a4db26fd65e51e6474 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Android: 0 20 | Exclude Editor: 1 21 | Exclude Linux64: 1 22 | Exclude OSXUniversal: 1 23 | Exclude Win: 1 24 | Exclude Win64: 1 25 | - first: 26 | Android: Android 27 | second: 28 | enabled: 1 29 | settings: 30 | CPU: x86 31 | - first: 32 | Any: 33 | second: 34 | enabled: 0 35 | settings: {} 36 | - first: 37 | Editor: Editor 38 | second: 39 | enabled: 0 40 | settings: 41 | CPU: AnyCPU 42 | DefaultValueInitialized: true 43 | OS: AnyOS 44 | - first: 45 | Facebook: Win 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Facebook: Win64 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: AnyCPU 56 | - first: 57 | Standalone: Linux64 58 | second: 59 | enabled: 0 60 | settings: 61 | CPU: AnyCPU 62 | - first: 63 | Standalone: OSXUniversal 64 | second: 65 | enabled: 0 66 | settings: 67 | CPU: AnyCPU 68 | - first: 69 | Standalone: Win 70 | second: 71 | enabled: 0 72 | settings: 73 | CPU: AnyCPU 74 | - first: 75 | Standalone: Win64 76 | second: 77 | enabled: 0 78 | settings: 79 | CPU: AnyCPU 80 | userData: 81 | assetBundleName: 82 | assetBundleVariant: 83 | -------------------------------------------------------------------------------- /Runtime/Plugins/Android/x86/libunitytuningfork.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android/tuningfork/53f37f5ac74c639427189203eba7a80a99c20e07/Runtime/Plugins/Android/x86/libunitytuningfork.so -------------------------------------------------------------------------------- /Runtime/Plugins/Android/x86/libunitytuningfork.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3276d77bec6cd4f64836f72baaf6619b 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Android: 0 20 | Exclude Editor: 1 21 | Exclude Linux64: 1 22 | Exclude OSXUniversal: 1 23 | Exclude Win: 1 24 | Exclude Win64: 1 25 | - first: 26 | Android: Android 27 | second: 28 | enabled: 1 29 | settings: 30 | CPU: x86 31 | - first: 32 | Any: 33 | second: 34 | enabled: 0 35 | settings: {} 36 | - first: 37 | Editor: Editor 38 | second: 39 | enabled: 0 40 | settings: 41 | CPU: AnyCPU 42 | DefaultValueInitialized: true 43 | OS: AnyOS 44 | - first: 45 | Facebook: Win 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Facebook: Win64 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: AnyCPU 56 | - first: 57 | Standalone: Linux64 58 | second: 59 | enabled: 0 60 | settings: 61 | CPU: AnyCPU 62 | - first: 63 | Standalone: OSXUniversal 64 | second: 65 | enabled: 0 66 | settings: 67 | CPU: AnyCPU 68 | - first: 69 | Standalone: Win 70 | second: 71 | enabled: 0 72 | settings: 73 | CPU: AnyCPU 74 | - first: 75 | Standalone: Win64 76 | second: 77 | enabled: 0 78 | settings: 79 | CPU: AnyCPU 80 | userData: 81 | assetBundleName: 82 | assetBundleVariant: 83 | -------------------------------------------------------------------------------- /Runtime/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc6dfe00330ae4d03927c7406680686d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Scripts/AdditionalLibraryMethods.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 89db3b647deb149c685c726dc80fa3a8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/AddressablesScenesEnumInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2022 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.IO; 22 | using System.Text.RegularExpressions; 23 | using UnityEngine; 24 | 25 | namespace Google.Android.PerformanceTuner 26 | { 27 | /// 28 | /// Associates addressables scene with their corresponding value in the Scene enum 29 | /// used by Android Performance Tuner's protobuf as listed in DevDescriptor.cs. 30 | /// 31 | [System.Serializable] 32 | public class AddressablesScenesEnumInfo 33 | { 34 | public string scenePath; 35 | public string protoEnumSceneName; 36 | public int value; 37 | 38 | static readonly Regex k_SceneFieldRegex = new Regex("[^a-zA-Z0-9_]"); 39 | 40 | public AddressablesScenesEnumInfo(string scenePath, int value) 41 | { 42 | this.scenePath = scenePath; 43 | protoEnumSceneName = ConvertScenePathToProtoEnumEntry(scenePath, true); 44 | this.value = value; 45 | } 46 | 47 | // Use this function to get the protobuf Scene Enum entry corresponding to a scene. 48 | public static string ConvertScenePathToProtoEnumEntry(string scenePath, bool isAddressableScene) 49 | { 50 | string sceneName = scenePath 51 | .Replace(Path.DirectorySeparatorChar, '_') 52 | .Replace(Path.AltDirectorySeparatorChar, '_') 53 | .Replace(Path.GetExtension(scenePath), "") 54 | .Replace(" ", "_") 55 | .ToUpper(); 56 | sceneName = k_SceneFieldRegex.Replace(sceneName, ""); 57 | string prefix = isAddressableScene ? "ADDR_" : ""; 58 | return prefix + sceneName; 59 | } 60 | 61 | public static int Compare(AddressablesScenesEnumInfo first, AddressablesScenesEnumInfo second) 62 | { 63 | return first.value >= second.value ? 1 : -1; 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /Runtime/Scripts/AddressablesScenesEnumInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 23e61b0c33865419593c1328d8601e4c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/AndroidLibraryMethods.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7281dc59b9a594c51b2521685c72fcf9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/AndroidPerformanceTuner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a584e723c507f475db7161c9ceb67b03 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/AndroidPerformanceTunerInternal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe477e362c38f4339a231812829940e9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/CInitializationSettings.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | 22 | using System; 23 | using System.Runtime.InteropServices; 24 | 25 | namespace Google.Android.PerformanceTuner 26 | { 27 | /// 28 | /// Initialization settings. 29 | /// Zero any values that are not being used. 30 | /// 31 | [StructLayout(LayoutKind.Sequential)] 32 | public struct CInitializationSettings 33 | { 34 | /// 35 | /// Cache object to be used for upload data persistence. 36 | /// If null, data is persisted to /data/local/tmp/tuningfork 37 | /// 38 | public IntPtr persistent_cache; 39 | 40 | /// 41 | /// The address of the Swappy_injectTracers function. 42 | /// If this is null, you need to call TuningFork_tick yourself. 43 | /// If it is set, telemetry for 4 instrument keys is automatically recorded. 44 | /// 45 | public SwappyTracerFn swappy_tracer_fn; 46 | 47 | /// 48 | /// Callback 49 | /// If set, this is called with the fidelity parameters that are downloaded. 50 | /// If null, you need to call TuningFork_getFidelityParameters yourself. 51 | /// 52 | public FidelityParamsCallback fidelity_params_callback; 53 | 54 | /// 55 | /// A serialized protobuf containing the fidelity parameters to be uploaded for training. 56 | /// Set this to nullptr if you are not using training mode. 57 | /// In training mode, these parameters are taken to be the parameters used within the game 58 | /// and they are used to help suggest parameter changes for different devices. Note that 59 | /// these override the default parameters loaded from the APK at startup. 60 | /// 61 | public IntPtr training_fidelity_params; 62 | 63 | /// 64 | /// A null-terminated UTF-8 string containing the endpoint that Tuning Fork will connect 65 | /// to for parameter, upload and debug requests. This overrides the value in base_uri in 66 | /// the settings proto and is intended for debugging purposes only. 67 | /// 68 | public IntPtr endpoint_uri_override; 69 | 70 | /// 71 | /// The version of Swappy that swappy_tracer_fn comes from. 72 | /// 73 | public uint swappy_version; 74 | 75 | /// 76 | /// The number of each metric that is allowed to be allocated at any given time. If any 77 | /// element is zero, the default for that metric type will be used. Memory for all metrics 78 | /// is allocated up-front at initialization. When all metrics of a given type are allocated, 79 | /// further requested metrics will not be added and data will be lost. 80 | /// 81 | public MetricLimits max_num_metrics; 82 | 83 | /// 84 | /// If non-null, this value overrides the api_key field in the app's 85 | /// tuningfork_settings.bin file. See tuningfork.proto for more information. 86 | /// 87 | public IntPtr api_key; 88 | 89 | /// 90 | /// If false, sensitive information is removed from native logging. 91 | /// 92 | public byte verbose_logging_enabled; 93 | 94 | /// 95 | /// If true, disables additional native telemetry collection 96 | /// 97 | public byte disable_async_telemetry; 98 | } 99 | } -------------------------------------------------------------------------------- /Runtime/Scripts/CInitializationSettings.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: baa944512202d437898b42f497d97b53 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/CProtobufSerialization.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Runtime.InteropServices; 23 | using AOT; 24 | using Google.Protobuf; 25 | using UnityEngine; 26 | 27 | namespace Google.Android.PerformanceTuner 28 | { 29 | /// 30 | /// Structure that helps to keep, serialize and deserialize data. 31 | /// 32 | [StructLayout(LayoutKind.Sequential)] 33 | public struct CProtobufSerialization 34 | { 35 | public IntPtr bytes; 36 | public UInt32 size; 37 | public IntPtr dealloc; 38 | 39 | /// 40 | /// Create serialization from proto message. 41 | /// 42 | /// proto message 43 | /// 44 | public static CProtobufSerialization Create(IMessage message) 45 | { 46 | byte[] bmsg = message.ToByteArray(); 47 | IntPtr p = Marshal.AllocHGlobal(bmsg.Length); 48 | Marshal.Copy(bmsg, 0, p, bmsg.Length); 49 | return new CProtobufSerialization() 50 | { 51 | bytes = p, 52 | size = (UInt32) bmsg.Length, 53 | dealloc = Marshal.GetFunctionPointerForDelegate(DeallocCallbackImpl) 54 | }; 55 | } 56 | 57 | delegate void DeallocCallback(ref CProtobufSerialization parameters); 58 | 59 | [MonoPInvokeCallback(typeof(DeallocCallback))] 60 | static void DeallocCallbackImpl(ref CProtobufSerialization parameters) 61 | { 62 | if (parameters.bytes != IntPtr.Zero) 63 | { 64 | Marshal.FreeHGlobal(parameters.bytes); 65 | } 66 | 67 | parameters.bytes = parameters.dealloc = IntPtr.Zero; 68 | parameters.size = 0; 69 | } 70 | 71 | /// 72 | /// Free all memory allocated by serialization. 73 | /// 74 | /// The serialized proto message. 75 | public static void CallDealloc(ref CProtobufSerialization ps) 76 | { 77 | if (ps.dealloc == IntPtr.Zero) 78 | { 79 | return; 80 | } 81 | 82 | DeallocCallback dealloc = 83 | Marshal.GetDelegateForFunctionPointer(ps.dealloc); 84 | if (dealloc != null) 85 | { 86 | dealloc(ref ps); 87 | } 88 | } 89 | 90 | /// 91 | /// Parse a proto message from serialization. 92 | /// 93 | /// Parser for proto message. 94 | public T ParseMessage() where T : class, IMessage, new() 95 | { 96 | var parser = new MessageParser(() => new T()); 97 | if (size == 0) return new T(); 98 | try 99 | { 100 | byte[] received = new byte[size]; 101 | Marshal.Copy((IntPtr) bytes, received, 0, (int) size); 102 | 103 | // TODO(b/120588304) Check and remove if it is not needed. 104 | int zero_trail = 0; 105 | for (; zero_trail < received.Length; zero_trail++) 106 | { 107 | if (received[received.Length - 1 - zero_trail] != 0) 108 | { 109 | break; 110 | } 111 | } 112 | 113 | ByteString toParse = ByteString.CopyFrom(received, 0, received.Length - zero_trail); 114 | 115 | T message = parser.ParseFrom(toParse); 116 | return message; 117 | } 118 | catch (Exception e) 119 | { 120 | Debug.LogWarning("Cannot parse message, " + e.ToString()); 121 | return null; 122 | } 123 | } 124 | } 125 | } -------------------------------------------------------------------------------- /Runtime/Scripts/CProtobufSerialization.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: baa0833353c704186b477bdc705f07a1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/DefaultLibraryMethods.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | #if UNITY_EDITOR || !UNITY_ANDROID 22 | using System; 23 | 24 | namespace Google.Android.PerformanceTuner 25 | { 26 | public class DefaultLibraryMethods : ILibraryMethods 27 | { 28 | public ErrorCode Init(FidelityParamsCallback fidelityParamsCallback, 29 | IntPtr trainingFidelityParams, IntPtr endpointUrlOverride) 30 | { 31 | return ErrorCode.PlatformNotSupported; 32 | } 33 | 34 | public ErrorCode InitWithSettings(ref CInitializationSettings settings) 35 | { 36 | return ErrorCode.PlatformNotSupported; 37 | } 38 | 39 | public ErrorCode GetFidelityParameters( 40 | ref CProtobufSerialization defaultParameters, 41 | ref CProtobufSerialization parameters, 42 | uint timeout) 43 | { 44 | return ErrorCode.PlatformNotSupported; 45 | } 46 | 47 | public ErrorCode SetCurrentAnnotation(ref CProtobufSerialization annotation) 48 | { 49 | return ErrorCode.PlatformNotSupported; 50 | } 51 | 52 | public ErrorCode FrameTick(InstrumentationKeys key) 53 | { 54 | return ErrorCode.PlatformNotSupported; 55 | } 56 | 57 | public ErrorCode Flush() 58 | { 59 | return ErrorCode.PlatformNotSupported; 60 | } 61 | 62 | public ErrorCode FindFidelityParamsInApk(string filename, ref CProtobufSerialization fidelityParameters) 63 | { 64 | return ErrorCode.PlatformNotSupported; 65 | } 66 | 67 | public bool SwappyIsEnabled() 68 | { 69 | return false; 70 | } 71 | 72 | public ErrorCode Destroy() 73 | { 74 | return ErrorCode.PlatformNotSupported; 75 | } 76 | 77 | public ErrorCode SetUploadCallback(UploadCallback uploadCallback) 78 | { 79 | return ErrorCode.PlatformNotSupported; 80 | } 81 | 82 | public ErrorCode SetFidelityParameters(ref CProtobufSerialization fidelityParameters) 83 | { 84 | return ErrorCode.PlatformNotSupported; 85 | } 86 | 87 | public ErrorCode FrameDeltaTimeNanos(InstrumentationKeys key, ulong dt) 88 | { 89 | return ErrorCode.PlatformNotSupported; 90 | } 91 | 92 | public ErrorCode StartTrace(InstrumentationKeys key, ref ulong handle) 93 | { 94 | return ErrorCode.PlatformNotSupported; 95 | } 96 | 97 | public ErrorCode EndTrace(ulong handle) 98 | { 99 | return ErrorCode.PlatformNotSupported; 100 | } 101 | 102 | public ErrorCode EnableMemoryRecording(bool enable) 103 | { 104 | return ErrorCode.PlatformNotSupported; 105 | } 106 | 107 | public ErrorCode StartRecordingLoadingTime( 108 | IntPtr eventMetadata, 109 | uint eventMetadataSize, 110 | ref CProtobufSerialization annotation, 111 | ref ulong handle) 112 | { 113 | return ErrorCode.PlatformNotSupported; 114 | } 115 | 116 | public ErrorCode StopRecordingLoadingTime(ulong handle) 117 | { 118 | return ErrorCode.PlatformNotSupported; 119 | } 120 | 121 | public ErrorCode ReportLifecycleEvent(LifecycleState state) 122 | { 123 | return ErrorCode.PlatformNotSupported; 124 | } 125 | 126 | public ErrorCode StartLoadingGroup(IntPtr eventMetadata, uint eventMetadataSize, 127 | IntPtr annotation, ref ulong handle) 128 | { 129 | return ErrorCode.PlatformNotSupported; 130 | } 131 | 132 | public ErrorCode StopLoadingGroup(ulong handle) 133 | { 134 | return ErrorCode.PlatformNotSupported; 135 | } 136 | 137 | public ErrorCode SetAggregationStrategyInterval(Submission method, uint intervalMsOrCount) 138 | { 139 | return ErrorCode.PlatformNotSupported; 140 | } 141 | 142 | public ErrorCode GetQualityLevelPredictions(ref QualityLevelPredictionsCStruct predStruct, UInt32 timeoutMS) 143 | { 144 | return ErrorCode.PlatformNotSupported; 145 | } 146 | 147 | public void FreeQualityLevelPredictions(ref QualityLevelPredictionsCStruct predStruct) 148 | { 149 | // Nothing to do here 150 | } 151 | } 152 | } 153 | #endif -------------------------------------------------------------------------------- /Runtime/Scripts/DefaultLibraryMethods.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2670298c7c8a9440a907b76b781739d5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/ErrorCode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a5880ac3151e4c7da9ba8ccff5dff2c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/FrameTracer.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using UnityEngine; 23 | 24 | namespace Google.Android.PerformanceTuner 25 | { 26 | public class FrameTracer : MonoBehaviour 27 | { 28 | public Action onAppInBackground; 29 | public Action onLifecycleChanged; 30 | 31 | LifecycleState currentLifecycleState 32 | { 33 | set 34 | { 35 | if (onLifecycleChanged != null) onLifecycleChanged(value); 36 | } 37 | } 38 | 39 | void Awake() 40 | { 41 | currentLifecycleState = LifecycleState.OnCreate; 42 | } 43 | 44 | void OnApplicationPause(bool pauseStatus) 45 | { 46 | if (onAppInBackground != null && pauseStatus) onAppInBackground(); 47 | currentLifecycleState = pauseStatus ? LifecycleState.OnStop : LifecycleState.OnStart; 48 | } 49 | 50 | void OnDestroy() 51 | { 52 | currentLifecycleState = LifecycleState.OnDestroy; 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Runtime/Scripts/FrameTracer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f2e66cde9db14d86b6967332c23bef1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/ILibraryMethods.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | 23 | namespace Google.Android.PerformanceTuner 24 | { 25 | public delegate void FidelityParamsCallback(ref CProtobufSerialization ps); 26 | 27 | public delegate void UploadCallback(IntPtr data, UInt32 size); 28 | 29 | public delegate void SwappyTracerFn(ref SwappyTracer swappyTracer); 30 | 31 | public struct SwappyTracer 32 | { 33 | } 34 | 35 | public interface ILibraryMethods 36 | { 37 | ErrorCode Init( 38 | FidelityParamsCallback setFidelityParams, 39 | IntPtr trainingFidelityParameters, 40 | IntPtr endpointUrlOverride); 41 | 42 | ErrorCode InitWithSettings( 43 | ref CInitializationSettings settings); 44 | 45 | ErrorCode GetFidelityParameters( 46 | ref CProtobufSerialization defaultParameters, 47 | ref CProtobufSerialization parameters, 48 | UInt32 timeout); 49 | 50 | ErrorCode SetCurrentAnnotation(ref CProtobufSerialization annotation); 51 | 52 | ErrorCode FrameTick(InstrumentationKeys key); 53 | 54 | ErrorCode Flush(); 55 | 56 | ErrorCode FindFidelityParamsInApk(string filename, ref CProtobufSerialization fp); 57 | 58 | bool SwappyIsEnabled(); 59 | 60 | ErrorCode Destroy(); 61 | 62 | ErrorCode SetUploadCallback(UploadCallback uploadCallback); 63 | 64 | ErrorCode SetFidelityParameters(ref CProtobufSerialization fp); 65 | 66 | ErrorCode FrameDeltaTimeNanos(InstrumentationKeys key, UInt64 timeNanos); 67 | 68 | ErrorCode StartTrace(InstrumentationKeys key, ref UInt64 handle); 69 | 70 | ErrorCode EndTrace(UInt64 handle); 71 | 72 | ErrorCode EnableMemoryRecording(bool enable); 73 | 74 | ErrorCode StartRecordingLoadingTime( 75 | IntPtr eventMetadataPtr, 76 | uint eventMetadataSize, 77 | ref CProtobufSerialization annotation, 78 | ref ulong handle); 79 | 80 | ErrorCode StopRecordingLoadingTime(ulong handle); 81 | 82 | ErrorCode ReportLifecycleEvent(LifecycleState state); 83 | 84 | ErrorCode StartLoadingGroup(IntPtr eventMetadataPtr, uint eventMetadataSize, IntPtr annotationPtr, 85 | ref ulong handle); 86 | 87 | ErrorCode StopLoadingGroup(ulong handle); 88 | 89 | ErrorCode SetAggregationStrategyInterval(Submission method, UInt32 intervalMsOrCount); 90 | 91 | ErrorCode GetQualityLevelPredictions(ref QualityLevelPredictionsCStruct predStruct, UInt32 timeoutMS); 92 | 93 | void FreeQualityLevelPredictions(ref QualityLevelPredictionsCStruct predStruct); 94 | } 95 | } -------------------------------------------------------------------------------- /Runtime/Scripts/ILibraryMethods.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84f538951ffc84cbe82e76b58edc77a5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/InitializationSettings.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using Google.Protobuf; 23 | 24 | namespace Google.Android.PerformanceTuner 25 | { 26 | /// 27 | /// Initialization settings. 28 | /// 29 | public struct InitializationSettings 30 | { 31 | /// 32 | /// Callback 33 | /// If set, this is called with the fidelity parameters that are downloaded. 34 | /// If null, you need to call TuningFork_getFidelityParameters yourself. 35 | /// ß 36 | public FidelityParamsCallback fidelityParamsCallback; 37 | 38 | /// 39 | /// A serialized protobuf containing the fidelity parameters to be uploaded for training. 40 | /// Set this to nullptr if you are not using training mode. 41 | /// In training mode, these parameters are taken to be the parameters used within the game 42 | /// and they are used to help suggest parameter changes for different devices. Note that 43 | /// these override the default parameters loaded from the APK at startup. 44 | /// 45 | public IMessage trainingFidelityParams; 46 | 47 | /// 48 | /// A null-terminated UTF-8 string containing the endpoint that Tuning Fork will connect 49 | /// to for parameter, upload and debug requests. This overrides the value in base_uri in 50 | /// the settings proto and is intended for debugging purposes only. 51 | /// 52 | public string endpointUriOverride; 53 | 54 | /// 55 | /// The number of each metric that is allowed to be allocated at any given time. If any 56 | /// element is zero, the default for that metric type will be used. Memory for all metrics 57 | /// is allocated up-front at initialization. When all metrics of a given type are allocated, 58 | /// further requested metrics will not be added and data will be lost. 59 | /// 60 | public MetricLimits maxNumMetrics; 61 | 62 | /// 63 | /// If false, sensitive information is removed from native logging. 64 | /// 65 | public bool verbose_logging_enabled; 66 | 67 | /// 68 | /// If true, disables additional native telemetry collection 69 | /// 70 | public bool disable_async_telemetry; 71 | } 72 | } -------------------------------------------------------------------------------- /Runtime/Scripts/InitializationSettings.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ba639bddbe154d0ebefbf0b3438d64b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/InstrumentationKeys.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Google.Android.PerformanceTuner 22 | { 23 | /// 24 | /// Instrument keys indicating time periods within a frame. 25 | /// Keys 64000-65535 are reserved 26 | /// 27 | public enum InstrumentationKeys 28 | { 29 | /// 30 | /// If GPU time is available, this is MAX(CpuTime, GpuTime). 31 | /// If not, this is the same as PacedFrameTime 32 | /// 33 | RawFrameTime = 64000, 34 | 35 | /// 36 | /// Frame time between ends of eglSwapBuffers calls or Vulkan queue present. 37 | /// 38 | PacedFrameTime = 64001, 39 | 40 | /// 41 | /// The time between frame start and the call to Swappy_swap. 42 | /// 43 | CpuTime = 64002, 44 | 45 | /// 46 | /// The time between buffer swap and GPU fence triggering. 47 | /// 48 | GpuTime = 64003, 49 | } 50 | } -------------------------------------------------------------------------------- /Runtime/Scripts/InstrumentationKeys.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 909c6f2c9edcf4052a21b5aff0e931fb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/LifecycleState.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Google.Android.PerformanceTuner 22 | { 23 | /// 24 | /// The set of states that the ReportLifecycleEvent method accepts. 25 | /// 26 | public enum LifecycleState 27 | { 28 | /// 29 | /// Uninitialized. 30 | /// 31 | Uninitialized = 0, 32 | /// 33 | /// OnCreate. 34 | /// 35 | OnCreate = 1, 36 | /// 37 | /// OnStart. 38 | /// 39 | OnStart = 2, 40 | /// 41 | /// OnStop. 42 | /// 43 | OnStop = 3, 44 | /// 45 | /// OnDestroy. 46 | /// 47 | OnDestroy = 4, 48 | } 49 | } -------------------------------------------------------------------------------- /Runtime/Scripts/LifecycleState.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 903dbcfca0a4452db4fa7f417eeac236 3 | timeCreated: 1604411542 -------------------------------------------------------------------------------- /Runtime/Scripts/LoadingTimeMetadata.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Runtime.InteropServices; 22 | 23 | // ReSharper disable InconsistentNaming. 24 | namespace Google.Android.PerformanceTuner 25 | { 26 | /// 27 | /// Metadata recorded with a loading time event. 28 | /// 29 | [StructLayout(LayoutKind.Sequential)] 30 | public class LoadingTimeMetadata 31 | { 32 | public enum LoadingState 33 | { 34 | Unknown = 0, 35 | 36 | /// 37 | /// The first time the game is run. 38 | /// 39 | FirstRun = 1, 40 | 41 | /// 42 | /// App is not backgrounded. 43 | /// 44 | ColdStart = 2, 45 | 46 | /// 47 | /// App is backgrounded. 48 | /// 49 | WarmStart = 3, 50 | 51 | /// 52 | /// App is backgrounded, least work needed. 53 | /// 54 | HotStart = 4, 55 | 56 | /// 57 | /// Asset loading between levels. 58 | /// 59 | InterLevel = 5 60 | } 61 | 62 | public LoadingState state; 63 | 64 | public enum LoadingSource 65 | { 66 | UnknownSource = 0, 67 | 68 | /// 69 | /// Uncompressing data. 70 | /// 71 | Memory = 1, 72 | 73 | /// 74 | /// Reading assets from APK bundle. 75 | /// 76 | Apk = 2, 77 | 78 | /// 79 | /// Reading assets from device storage. 80 | /// 81 | DeviceStorage = 3, 82 | 83 | /// 84 | /// Reading assets from external storage, for example SD card. 85 | /// 86 | ExternalStorage = 4, 87 | 88 | /// 89 | /// Loading assets from the network. 90 | /// 91 | Network = 5, 92 | 93 | /// 94 | /// Shader compilation. 95 | /// 96 | ShaderCompilation = 6, 97 | 98 | /// 99 | /// Time spent between process starting and onCreate. 100 | /// 101 | PreActivity = 7, 102 | 103 | /// 104 | /// Total time spent between process starting and first render frame. 105 | /// 106 | FirstTouchToFirstFrame = 8, 107 | 108 | /// 109 | /// Time from start to end of a group of events. 110 | /// 111 | TotalUserWaitForGroup = 9 112 | } 113 | 114 | public LoadingSource source; 115 | 116 | /// 117 | /// 0 = no compression, 100 = max compression 118 | /// 119 | public int compression_level; 120 | 121 | public enum NetworkConnectivity 122 | { 123 | Unknown = 0, 124 | Wifi = 1, 125 | CellularNetwork = 2 126 | } 127 | 128 | public NetworkConnectivity network_connectivity; 129 | 130 | /// 131 | /// Bandwidth in bits per second. 132 | /// 133 | public ulong network_transfer_speed_bps; 134 | 135 | /// 136 | /// Latency in nanoseconds. 137 | /// 138 | public ulong network_latency_ns; 139 | 140 | public static LoadingTimeMetadata Copy(LoadingTimeMetadata toBeCopied) 141 | { 142 | LoadingTimeMetadata newMetadata = new LoadingTimeMetadata() 143 | { 144 | state = toBeCopied.state, 145 | source = toBeCopied.source, 146 | compression_level = toBeCopied.compression_level, 147 | network_connectivity = toBeCopied.network_connectivity, 148 | network_transfer_speed_bps = toBeCopied.network_transfer_speed_bps, 149 | network_latency_ns = toBeCopied.network_latency_ns 150 | }; 151 | return newMetadata; 152 | } 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /Runtime/Scripts/LoadingTimeMetadata.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 682775c939bf44e480ba976e2f0ac5dd 3 | timeCreated: 1604411817 -------------------------------------------------------------------------------- /Runtime/Scripts/MessageUtil.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Reflection; 23 | using Google.Protobuf; 24 | using Google.Protobuf.Reflection; 25 | using UnityEngine; 26 | 27 | namespace Google.Android.PerformanceTuner 28 | { 29 | /// 30 | /// Helper class to set/get values for default fields via reflection. 31 | /// 32 | public static class MessageUtil 33 | { 34 | [Obsolete] 35 | public enum LoadingState 36 | { 37 | NotLoading = 1, 38 | Loading = 2, 39 | } 40 | 41 | const string k_QualityLevelObjectField = "Level"; 42 | 43 | const string k_SceneObjectField = "Scene"; 44 | 45 | const string k_LoadingStateField = "LoadingState"; 46 | 47 | /// 48 | /// Check if message contains enum field with 0-value / invalid value. 49 | /// 50 | public static bool HasInvalidEnumField(IMessage message) 51 | { 52 | foreach (var field in message.Descriptor.Fields.InDeclarationOrder()) 53 | { 54 | if (field.FieldType != FieldType.Enum) continue; 55 | int enumValue = (int) field.Accessor.GetValue(message); 56 | if (enumValue == 0) return true; 57 | } 58 | 59 | return false; 60 | } 61 | 62 | 63 | /// 64 | /// Get QualityLevel field value via reflection 65 | /// 66 | /// Message contains quality level 67 | /// 68 | public static int GetQualityLevel(IMessage message) 69 | { 70 | var qualityLevelObj = message.GetType().InvokeMember( 71 | k_QualityLevelObjectField, 72 | BindingFlags.GetProperty, 73 | Type.DefaultBinder, 74 | message, 75 | null); 76 | return (int) qualityLevelObj; 77 | } 78 | 79 | 80 | public static bool HasQualityLevel() 81 | where TFidelity : class, IMessage, new() 82 | { 83 | var property = new TFidelity().GetType().GetProperty(k_QualityLevelObjectField); 84 | return property != null; 85 | } 86 | 87 | /// 88 | /// Set value for QualityLevel field via reflection. 89 | /// 90 | /// The message to update 91 | /// The QualityLevel to set. 92 | public static void SetQualityLevel(IMessage message, int qualityLevel) 93 | { 94 | message.GetType().InvokeMember( 95 | k_QualityLevelObjectField, 96 | BindingFlags.SetProperty, 97 | Type.DefaultBinder, 98 | message, 99 | new object[] {qualityLevel}); 100 | } 101 | 102 | 103 | public static bool HasLoadingState() 104 | where TAnnotation : class, IMessage, new() 105 | { 106 | var property = new TAnnotation().GetType().GetProperty(k_LoadingStateField); 107 | return property != null; 108 | } 109 | 110 | /// 111 | /// Set value for Scene field via reflection. 112 | /// 113 | /// The message to update 114 | /// The scene's build index to set. 115 | public static void SetScene(IMessage message, int sceneBuildIndex) 116 | { 117 | // 0-index values in all enums are invalid. 118 | // Scene with index 0 has enum with index 1. 119 | // Increase sceneBuildIndex by one to match index in Scene enum. 120 | sceneBuildIndex++; 121 | var sceneEnumType = message.GetType().GetProperty(k_SceneObjectField).PropertyType; 122 | 123 | // To prevent incorrect enum value. 124 | var enumSize = Enum.GetValues(sceneEnumType).Length; 125 | sceneBuildIndex = Mathf.Clamp(sceneBuildIndex, 0, enumSize - 1); 126 | 127 | message.GetType().InvokeMember( 128 | k_SceneObjectField, 129 | BindingFlags.SetProperty, 130 | Type.DefaultBinder, 131 | message, 132 | new object[1] {Enum.ToObject(sceneEnumType, sceneBuildIndex)}); 133 | } 134 | 135 | public static bool HasScene() 136 | where TAnnotation : class, IMessage, new() 137 | { 138 | var property = new TAnnotation().GetType().GetProperty(k_SceneObjectField); 139 | return property != null; 140 | } 141 | } 142 | } -------------------------------------------------------------------------------- /Runtime/Scripts/MessageUtil.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2cce53e39623a478bb8e596daaf85615 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/MetricLimits.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Runtime.InteropServices; 22 | 23 | namespace Google.Android.PerformanceTuner 24 | { 25 | /// 26 | /// Limits on the number of metrics of each type. 27 | /// Zero any values to get the default for that type: 28 | /// Frame time: min(64, the maximum number of annotation combinations) * num_instrument_keys. 29 | /// Loading time: 32. 30 | /// Memory: 15 possible memory metrics. 31 | /// Battery: 32. 32 | /// 33 | [StructLayout(LayoutKind.Sequential)] 34 | public struct MetricLimits 35 | { 36 | public uint frame_time; 37 | public uint loading_time; 38 | public uint memory; 39 | public uint battery; 40 | } 41 | } -------------------------------------------------------------------------------- /Runtime/Scripts/MetricLimits.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a745d008a1f4222bc1312197410ea5d 3 | timeCreated: 1604918932 -------------------------------------------------------------------------------- /Runtime/Scripts/Proto.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b7aea40fe2cd1427aa13a32c739efc4a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Scripts/Proto/Tuningfork.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c5d22f4e778c48d1bac716d4dd1ea06 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/ProtoMessageType.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Google.Android.PerformanceTuner 22 | { 23 | /// 24 | /// Enum for different proto messages. 25 | /// 26 | public enum ProtoMessageType 27 | { 28 | FidelityParams, 29 | Annotation 30 | } 31 | } -------------------------------------------------------------------------------- /Runtime/Scripts/ProtoMessageType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 429460a426f73422382801386ccc173c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/QualityLevelPredictions.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2023 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Runtime.InteropServices; 23 | using Google.Protobuf; 24 | using UnityEngine; 25 | 26 | namespace Google.Android.PerformanceTuner 27 | { 28 | /// 29 | /// A structure to match the struct returned from the predictability API. 30 | /// 31 | [StructLayout(LayoutKind.Sequential)] 32 | public struct QualityLevelPredictionsCStruct 33 | { 34 | public IntPtr fidelityParams; 35 | public IntPtr predictedTimeUs; 36 | public uint size; 37 | } 38 | 39 | /// 40 | /// A structure holding a fidelity and the corresponding predicted frame time 41 | /// in microseconds. In some cases when the parsing of fidelity has gone wrong, 42 | /// fidelity member will be null. 43 | /// 44 | public class QualityLevelPredictions 45 | where TFidelity : class, IMessage, new() 46 | { 47 | public TFidelity fidelity; 48 | public int predictedTimeUs; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Runtime/Scripts/QualityLevelPredictions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f7e861da9eb492458e0103156e73f51 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/Result.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2020 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Google.Android.PerformanceTuner 22 | { 23 | /// 24 | /// Represents a value returned by an operation, 25 | /// with the associated error code. 26 | /// 27 | /// The type of the value contained in the result. 28 | public class Result 29 | { 30 | /// 31 | /// The error code returned by the operation that led to this result. 32 | /// 33 | public readonly ErrorCode errorCode; 34 | 35 | /// 36 | /// The value returned by the operation that led to this result. 37 | /// 38 | public readonly T value; 39 | 40 | /// 41 | /// Create a result with the given value and the associated error code. 42 | /// 43 | /// The error code. 44 | /// The value. 45 | public Result(ErrorCode errorCode, T result) 46 | { 47 | this.errorCode = errorCode; 48 | this.value = result; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Runtime/Scripts/Result.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b47e9b93eb1145909b38a22af9a9767 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/SetupConfig.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7043250a3f6d44263884710e80a6b001 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/Submission.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2021 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Google.Android.PerformanceTuner 22 | { 23 | /// 24 | /// The set of submission types that the SetAggregationStrategyInterval method accepts. 25 | /// 26 | public enum Submission 27 | { 28 | /// 29 | /// Undefined submission method. Should not be set to this. 30 | /// 31 | Undefined = 0, 32 | 33 | /// 34 | /// Submission based on elapsed time. 35 | /// 36 | TimeBased = 1, 37 | 38 | /// 39 | /// Submission based on the elapsed number of ticks. 40 | /// 41 | TickBased = 2, 42 | } 43 | } -------------------------------------------------------------------------------- /Runtime/Scripts/Submission.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88cf51bf595ac9043a8fecaef15c07f2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/TunerMode.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // 4 | // Copyright 2021 Google Inc. All Rights Reserved. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Google.Android.PerformanceTuner 22 | { 23 | public enum TunerMode 24 | { 25 | Insights = 0, 26 | Experiments = 1, 27 | } 28 | } -------------------------------------------------------------------------------- /Runtime/Scripts/TunerMode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e498292124ed4b1eaa57ea0ee06e5547 3 | timeCreated: 1609850127 -------------------------------------------------------------------------------- /Runtime/Scripts/UploadTelemetryRequest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e35245edec7f417992e58ea819336eb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Utilities/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d83d3719048f64962ba2305e23350096 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Utilities/Editor/LoadingSceneTrackerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9059b8bd0d50c4d54be2da3988db6f85 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Utilities/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 037ff6acf93bc4301b596830a9ace004 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Utilities/Runtime/LoadingSceneTracker.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2517898c1b0074f9792b097b1eb2bb3a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /link.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /link.xml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf50d6ed0b5ff4d54b08c989a53e989f 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.google.android.performancetuner", 3 | "displayName": "Android Performance Tuner", 4 | "version": "2.0.0", 5 | "unity": "2019.4", 6 | "description": "Android Performance Tuner is a library reporting frame rendering times of your game across different devices and game stages. This plugin helps to integrate the library into your Unity project.", 7 | "author": { 8 | "name": "Google LLC" 9 | }, 10 | "keywords": [ 11 | "android", 12 | "google", 13 | "performance" 14 | ], 15 | "samples": [ 16 | { 17 | "displayName": "Android Performance Tuner Utility", 18 | "description": "Utility scripts for Android Performance Tuner Unity Plugin", 19 | "path": "Samples~/Utilities" 20 | }] 21 | } 22 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d547e81b94bb3493483c7e5c9a328ff5 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------