[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-08-26 UTC。"],[],[],null,["This guide describes how to use a Unity plugin to record and upload frame time\ndata from **Unity 2017.4 or later**.\n| **Note:** For a guided tutorial, see the [Integrating Android Performance Tuner into your Unity game Codelab](https://codelabs.developers.google.com/codelabs/android-performance-tuner-unity).\n\nFor game engines using C or C++, see the\n[guide for native game engines](/games/sdk/performance-tuner/custom-engine).\n\nBackground\n\nA key component of the game experience is *rendering performance*. Rendering\nperformance is an outcome of the following two inputs:\n\n- Frame rate: How often a frame is drawn.\n- Graphical quality settings: Level of fidelity at which a frame is presented, including simulation fidelity as well as graphics.\n\nFor games, good rendering performance is defined as the following:\n\n- Delivering a stable, consistent frame rate (that is, the percentage of frames rendering at the desired frequency).\n- Rendering frames at the highest frequency possible while maintaining stability, typically 30 or 60 FPS depending on the type of game.\n- Maximizing the level of detail for a user given their screen size and density while still achieving a desired, stable frame rate.\n\nThe [Android Frame Pacing library](/games/sdk/frame-pacing) limits much of the\nvariation in frame times, providing a stable frame rate for games. The remaining\nvariation in frame times is due to the level of detail displayed during certain\nscenes in gameplay and the graphical capabilities of the device. Using\nAndroid Performance Tuner, you can pinpoint times during gameplay when the frame time\nis slower or faster than your target, and correlate these issues and\nopportunities to:\n\n- Specific quality settings\n- Specific scenes in your game\n- Specific device models or device specs\n\nRecord and upload data\n\nThe Tuning Fork library relies on one of its tick functions being called\neach frame by the Android Frame Pacing library (or by the Unity engine for older\nversions of Unity where the Frame Pacing Library is not present). Within the\nlibrary, this tick information is aggregated into histograms which are then\nperiodically uploaded to Google Play through an HTTP endpoint. Each tick is\nrecorded as being associated with an [instrument key](#instrument-keys) and an\n[annotation](#annotations). You define annotations using the Unity plugin.\n\nInstrument keys\n\nAn instrument key indicates where in the frame the tick comes from and is an\ninteger that must be passed to each tick function call. This is done\nautomatically by the Unity plugin. If the Optimized Frame Pacing option is\nenabled in the Unity settings for your game (available in\nUnity version 2019.3.14 or later), Android Performance Tuner will use\ninformation from the Android Frame Pacing library to report enhanced metrics.\n\nAnnotations\n\nAnnotations give contextual information about what your game is doing when a\ntick is recorded. For example, an annotation could identify any of the\nfollowing:\n\n- The current game level\n- A specific scene is loading\n- A \"big boss\" is on the screen\n- Any other relevant game state information\n\nAnnotations are defined in a dialog provided by the Unity plugin.\n\nInternally, the Tuning Fork library uses Google's protocol buffer format\nto store annotations and fidelity parameters. This is a well-defined,\nmulti-language protocol for extensible, structured data. For more information,\nsee the\n[Protocol Buffers documentation](https://developers.google.com/protocol-buffers/).\n\nFidelity parameters\n\nFidelity parameters influence the performance and graphical fidelity of your\ngame, such as mesh level-of-detail, texture resolution, and anti-aliasing\nmethod. Like annotations, fidelity parameters are defined in a dialog provided\nby the Unity plugin.\n\nMemory and CPU overhead\n\nAll memory used by the Tuning Fork library is allocated at\ninitialization in order to avoid surprises during gameplay. The size of the data\ndepends on the number of instrument keys, number of possible annotations, and\nnumber of buckets in each histogram; it is a multiple of all of these times four\nbytes for each bucket. There are also two copies of all histograms to allow for\nsubmission in a double-buffered fashion.\n\nSubmission occurs on a separate thread and doesn't block tick calls. If no\nupload connection is available, the submission is queued for later upload.\n\nThere is little processing overhead to calling a tick function: it simply\ncalculates an index into the array of histogram buckets and increments an\ninteger count.\n\nWeb requests\n\nThe library makes two kinds of requests to the server endpoint:\n\n- A `generateTuningParameters` request at initialization\n- Periodically during gameplay, an `uploadTelemetry` request to send data to the server\n\nOffline players\n\nIf there is no available connection at initialization, the request is retried\nseveral times with an increasing back-off time. If there is no connection at\nupload, the upload is cached. Uploads are stored as files in temporary storage.\n\nRequirements\n\nTo use the plugin in your game, use a supported version of Unity:\n\n- Unity version 2017.4 or later and [.NET version 4.6](https://dotnet.microsoft.com/download/dotnet-framework/net46)\n- To use APK Expansion files, Unity 2018.2 is required\n- For improved frame pacing and GPU measurements, Unity version 2019.3.14 or later is required\n- For Addressables scenes support, Unity 2019.3 or later and [Addressables package 1.19.4](https://docs.unity3d.com/Packages/com.unity.addressables@0.8/manual/index.html) or later are required.\n\nIntegrate Android Performance Tuner in Unity\n\nFor information about integrating Android Performance Tuner in Unity, see\n[Enable the API](/games/sdk/performance-tuner/unity/enable-api)."]]