Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Official Adaptive Performance Package

Discussion in 'Android' started by David-Berger, Mar 28, 2019.

  1. apklance

    apklance

    Joined:
    Feb 6, 2022
    Posts:
    1
    Thanks for sharing Adaptive performance. Can I use it for any android?
     
  2. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    @apklance currently it's supported on Samsung device, but keep an eye open around GDC later in March for updates. I'll post our talks and any news here once they are available as well.
     
  3. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    We released several version updates of Adaptive Performance and Samsung Android last week. Those versions come with several optimizations, documentation and bug fixes. They are verified package and 4.0 moved from release candidate to verified as well:

    • com.unity.adaptiveperformance@2.2.3 (Unity 2020.2+)
    • com.unity.adaptiveperformance.samsung.android@2.2.2 (Unity 2020.2+)
      • com.unity.adaptiveperformance@3.0.2 (Unity 2021.2+)
      • com.unity.adaptiveperformance.samsung.android@3.0.1 (Unity 2021.2+)
    • com.unity.adaptiveperformance@4.0.0 (Unity 2022.2+)
    • com.unity.adaptiveperformance.samsung.android@4.0.0 (Unity 2022.2+)
     
  4. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    Leading up to GDC 2022, Arm released a blog post talking about work with do with them on Adaptive Performance. This is amazing new and I'm looking forward sharing more with you during GDC.

    We will give 2 talks related to Adaptive Performance during GDC:
    • Optimizing mobile gameplay with Adaptive Performance (partner session with Arm)
    • Unfolding your gaming potential with Galaxy GameDev (partner session with Samsung)
    Make sure to come and join us for the talks if you are at GDC or view them online once released.
     
  5. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    150
    Unfortunately, I'm betting this package is useless for most developers if it doesn't support all iOS and Android devices in some form. It's cool that it is becoming super feature-rich for Samsung, but I think most would appreciate a "broad" approach over a "deep" approach - if you know what I mean.

    With that said, I would be perfectly happy with just using the framerate for scaling.
    Could you give any overall feedback on pitfalls if we decided to create our own provider for iOS and all other androids? Why exactly hasn't unity made a "framerate-only" generic adaptive performance provider? In my mind, developers could decide how much GPU vs CPU scalers should be affected by the FPS indicator. Also, this could work without frame-timings enabled (which I've read in itself can have a performance impact), giving us some performance in return. Or am I missing something?
     
    freso, JesOb and Midiphony-panda like this.
  6. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    @TheVirtualMunk agreed, we are working on other providers to make AP a more broad experience. I highly recommend to watch the GDC sessions. Our goal is though to broaden the API world on more platforms to provide the info needed and this is a hard and slow process. And you might imagine that getting hardware close APIs is quite difficult for performance and security reasons and 3+ years is not uncommon to get new APIs. Look at variable refreshrate Displays. It took us more than 5 years do advocate for display refresh rate of under 30Hz and just now the S22 Ultra enables us to do that. We do work quite closely with a lot of our partners to enable those APIs and some work has already been released recently (Android 11/12/13) and we are preparing providers which utilize them. As always, you can use them in your own provider in the meantime.

    The pitfalls of that are rather simple, we ship with our tests so you can run the API tests, but it essentially only requires one provider file to be changed. It helps if you know how to make native plugins in Unity to get the native data, but otherwise all C# (use the Samsung provider package as template).
    We try to not break the APIs and so far we were quite successful as hardly any of the APIs changed but for 5.0 we anticipate that this might change as we have to remove a discontinued package we were using, but with the benefit to make Adaptive Performance even more flexible to add platform specific features.

    As for frame-timing resources, that's mostly on the memory side as you have to store the data and allocate the memory which are a few bytes. CPU performance is somewhat neglectable. The whole entity of Adaptive Performance is in the sub ms area which includes the frame-timing resources.
     
    TheVirtualMunk likes this.
  7. Kobald-Klaus

    Kobald-Klaus

    Joined:
    Jun 20, 2014
    Posts:
    127
    @David-Berger - please help:
    I do not get it:
    I installed the adaptive performance package. I can see the extra gameobject being created at startup. So, does it do anything automatically? As a start, I simply want to reduce resolution when framerate drops on any device. Of course mostly on Android but not only Samsung. As usual the doc does not explain how to take simple steps. (Guys, please work on the documentation philosophy! It's hard to read the mind of what you developers were thinking of!!!)
    A simple 1-2-3 step getting started would be appreciated.
     
  8. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    @Kobald-Klaus That's correct, after you install it the automatic performance mode is working, if enabled in the settings. Now, this only work for Samsung atm, we work on a more general Android solution but it's not out yet.

    You can use Adaptive Resolution to change resolution based on device thermals and performance. You can look at the provided Sample and Sample Documentation to see how it works. However, this does not work based on FPS, it works based on Indexer Thermal and Performance Status.
     
  9. Kobald-Klaus

    Kobald-Klaus

    Joined:
    Jun 20, 2014
    Posts:
    127
    I am currently doing it by myself. When framerate drops resolution is set down to 50%. Yes, checking thermal state would be better, but it´s a good simple solution for now.
     
    David-Berger and TheVirtualMunk like this.
  10. vannus

    vannus

    Joined:
    Jun 30, 2014
    Posts:
    7
    how do i get rid of this thing?
    When i tried building with it I got a version 53/52 compatibility issue even though I installed the JDK along with Unity 2021.3.3f1 LTS.

    Turning it off in project settings, uninstalling the package, unticking development build and unity still refuses to build without it!
     
  11. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    This is not an issue with Adaptive Performance. You might need to look into setting JDK_HOME and JRE_HOME point to JAVA 1.8 or whatever version you want to use eventually. You might have installed JDK before? which sets the env variables.
     
  12. MX-Pain

    MX-Pain

    Joined:
    Sep 27, 2020
    Posts:
    49
    Hello there,
    So I have installed the package mentioned and noticed that I don't see it from the project settings .....
    upload_2022-6-7_13-53-44.png

    I have Unity 2019 Lts, Am I in the correct path ?

    Edit: I have updated to 2021 the project and now I can see the options in project settings. Tho this was compatible with 2019 or the option is somewhere else ?
     
    Last edited: Jun 7, 2022
  13. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    @MX-Pain You only have settings with Adaptive Performance 2.x+. Version 1.x does not come with settings.
     
    MX-Pain likes this.
  14. Qixiant

    Qixiant

    Joined:
    Apr 22, 2019
    Posts:
    3
    Hi, I'm confused with the thermal metrics level. how did u get the map temperature and performace ? I mean if tempreature more than xxx, the performace will drop fast... What are the evaluation criteria ? or that just defined by mobile vender api?
     
  15. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    Hi,
    It depends on what thermal state it is, if it's thermal throttling it will drop fast, if throttling is immediate it depends on the thermal trend.
     
  16. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    We recently release new versions with bugfixes, please find more details in the changelog and samsung provider hangelog:
    • com.unity.adaptiveperformance@1.2.3
    • com.unity.adaptiveperformance@2.2.4
    • com.unity.adaptiveperformance@3.0.3
    • com.unity.adaptiveperformance@4.0.1
    • com.unity.adaptiveperformance.samsung.android@1.2.3
    • com.unity.adaptiveperformance.samsung.android@2.2.4
    • com.unity.adaptiveperformance.samsung.android@3.0.3
    • com.unity.adaptiveperformance.samsung.android@4.0.1
     
  17. alvaro_perez_alarcon_lively

    alvaro_perez_alarcon_lively

    Joined:
    Aug 11, 2022
    Posts:
    2
    Good morning! I'm on Unity 2021.1.27f1 and I cannot find the Samsung subsystem package on the Package Manager.

    Is there an ETA of where it could become available for other platforms? We wanted to use this package to monitor device heat and lower quality settings depending on it, but it seems like being samsung only it's too niche to be viable.
     
  18. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    You can install the Samsung provider in the Adaptive Performance Project Settings - just enable the Samsung provider and it will download and install the provider (package).

    We are working on a general Android provider at the moment, but there is not release set yet.
     
  19. JonPQ

    JonPQ

    Joined:
    Aug 10, 2016
    Posts:
    120
    Hello, I am trying this out currently, initially I'm trying to get the Thermal/throttling information and display it to the screen.
    I am on Unity 2021.3.8f1 Installed adaptive performance , enabled the android built mode checkbox, Package manager is showing version 4.0.1 installed for AP and Samsung android.
    Initialize on startup, and Samsung Android Provider checkboxes are enabled.
    I am only doing 2 lines of code...
    according to the docs, this should get me started...
    Code (CSharp):
    1. private IAdaptivePerformance ap;
    2. ap = Holder.Instance;
    But on device build... Holder.instance is always null....
    I have tried the build on 4 or 5 samsungs... all with the same error.
    Scaler profiles are all default / disabled... not using any of those yet.

    What am I missing please ? or do I need a specific test device ?
    How do I get Holder.instance ?
    I tried checking Holder.instance both at app start, and after a long pause of loading.... still null.
    Any help appreciated, thanks.
    • Samsung S5 ( too old ? ) ”missing holder instance

    • Samsung S9 running Android 9 ( too old OS ? ) …. trying this…. does not work. error…”missing holder instance”. (might need updating to Android 10)

    • Samsung Tab-A running Android 11…. trying this…. does not work. still gets error…”missing holder instance
    • Samsung Tab-A 8” running Android 11… trying this…. does not work. still gets error…”missing holder instance


    update... works... just on a small subset of devices and OS
     
    Last edited: Oct 11, 2022
  20. Anthony-V

    Anthony-V

    Unity Technologies

    Joined:
    Apr 29, 2021
    Posts:
    3
    Breaking News!!

    We recently released preview versions of Adaptive Performance and Samsung Android 5.0.0-pre, as well as a new provider, Google Android 1.0.0-pre. These are release candidates and not verified packages; they will come as verified packages in 2023.1+ but also work with 2021.2+.

    New in 5.0
    • Support for the new Google Android provider, which can improve frame rate stability and battery usage across supported Android devices. This new provider takes advantage of the following Android APIs:
    • New APIs for enhanced control of the lifecycle of Adaptive Performance. See the Lifecycle Management sample for more details.
    • Removed dependency on a deprecated Subsystem package and now utilizing the internal subsystem libraries available in the core Editor. This introduced a new APProvider class.

    Installation
    To install the RC package(s), please add them manually to the package manifest.
    Code (CSharp):
    1.     "com.unity.adaptiveperformance": "5.0.0-pre.2",
    2.     "com.unity.adaptiveperformance.google.android": "1.0.0-pre.3",
    3.     "com.unity.adaptiveperformance.samsung.android": "5.0.0-pre.2",

    We would love to hear your feedback using these new Adaptive Performance versions! Reach out with any questions.
     
  21. IIporpammep

    IIporpammep

    Joined:
    Aug 16, 2015
    Posts:
    39
    Hi, it's great that you've added Google Android provider.

    Am I right that this provider supports any Android device with Android version 12+(except for getGameMode/setGameState api that require Android 13 and Google Pixel 6)?

    Do you plan to add Android 11 support?(getThermalHeadroom/ getCurrentThermalStatus/ ThermalStatusChangedListener methods require api level 29/30 which're supported by Android 11)
     
    Last edited: Dec 15, 2022
  22. Anthony-V

    Anthony-V

    Unity Technologies

    Joined:
    Apr 29, 2021
    Posts:
    3
    Hi IIporpammep!
    Yes, as long as the Android SDK version is met, and the physical device supports the underlying APIs, our new Android provider can be used across Android devices.

    And yes, the thermal APIs you listed are supported and have been integrated with the existing thermal functionality within Adaptive Performance. We're also utilizing additional Android APIs that became available in Android 12, and together they form the foundation of our new Android provider. Take a look at our docs for more info.

    Hope this helps! Thanks!
     
    andreiagmu and IIporpammep like this.
  23. AshwinTheGammer

    AshwinTheGammer

    Joined:
    Sep 23, 2016
    Posts:
    69
    Does this mean that I can use Android Performance across any android device? not just samsung?:rolleyes: Am I right?
     
  24. Anthony-V

    Anthony-V

    Unity Technologies

    Joined:
    Apr 29, 2021
    Posts:
    3
    Hi AshwinTheGamer!
    Yes, as long as the Android SDK version is met, and the physical device supports the underlying APIs (which are outlined in our docs), our new Android provider can be used across Android devices.

    Hope this helps! Thanks!
     
    andreiagmu and AshwinTheGammer like this.
  25. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    We recently released preview versions of Adaptive Performance 5.0.0, Samsung Android 5.0.0, and the new Android Provider 1.0.0. Today we release the verified packages; they come as verified packages in 2023.1+ but also work with 2021.2+.

    New in 5.0
    • Support for the new Android Provider, which can improve frame rate stability and battery usage across supported Android devices. This new provider takes advantage of the following Android APIs:
    • New APIs for enhanced control of the lifecycle of Adaptive Performance. See the Lifecycle Management sample for more details.
    • Removed dependency on a deprecated Subsystem package and now utilizing the internal subsystem libraries available in core Unity. This introduced a new APProvider class.

    Installation
    To install the package(s), please add them manually to the package manifest or install them via the settings menu or the package manager.
    Code (CSharp):
    1.     "com.unity.adaptiveperformance": "5.0.0",
    2.     "com.unity.adaptiveperformance.google.android": "1.0.0",
    3.     "com.unity.adaptiveperformance.samsung.android": "5.0.0",

    As always we love to hear your feedback using those new Adaptive Performance versions.
     
    AshwinTheGammer likes this.
  26. AshwinTheGammer

    AshwinTheGammer

    Joined:
    Sep 23, 2016
    Posts:
    69
  27. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
  28. nathan2019spence

    nathan2019spence

    Joined:
    Jan 21, 2022
    Posts:
    19
    How can we disable all the notifications so we can publish the apk?
     
  29. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    @nathan2019spence which notification do you mean? If you talk about logging, it won't log anything in a non development build.
     
  30. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,113
    I would like to ask is that Adaptive Performance still only officially support Samsung brand? Can it supports other brand like Xiaomi?
     
    Unifikation likes this.
  31. AshwinTheGammer

    AshwinTheGammer

    Joined:
    Sep 23, 2016
    Posts:
    69
    Yes, as long as the Android SDK version is met, and the physical device supports the underlying APIs (which are outlined in our docs), our new Android provider can be used across Android devices.
     
    hayashi-hololab likes this.
  32. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    @optimise yes it does. There was a bug which did not let it run correctly in 1.0.0, but we fixed it in Android Provider 1.1.0 which is being released today. Please run update and try it on the Xiaomi device. @AshwinTheGammer is right too. The Android APIs need to be implemented for it to work as expected.
     
  33. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    We released an update for the Android Provider version 1.1.0 today. It comes as verified packages in 2023.1+ but also work with 2021.2+.

    New in Google Android 1.1.0

    • Rework how Android APIs of Android 11, 12, 13 are integrated and used so we can target Android 11 and not only Android 12+ to provide minimal features sets to the platform (thermal events).
    • Fixed Android APIs to ensure we run on any Android device not only Google Pixel devices.

    Installation
    To install the package(s), please add them manually to the package manifest or install them via the Adaptive Performance Provider settings menu or upgrade in the package manager.
    Code (CSharp):
    1. "com.unity.adaptiveperformance": "5.0.0",
    2. "com.unity.adaptiveperformance.google.android": "1.1.0",

    As always we love to hear your feedback using those new Adaptive Performance versions.
     
    IIporpammep likes this.
  34. Ootherworld

    Ootherworld

    Joined:
    Nov 28, 2022
    Posts:
    2
    Does using Adaptive Performance have a significant impact on memory? I noticed that the providers all use AndroidJNI, which can result in some additional memory overhead and GC.
     
  35. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    @Ootherworld the Samsung Provider does, the Android Provider does not. But even there the class is very small and won't have a large footprint.
     
  36. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    We released an update for Adaptive Performance version 5.0.1 and the Android Provider version 1.1.1 today. It comes as verified packages in 2023.2+ but also work with 2021.2+.

    New in Google Android 1.1.1

    • Fixed wrong threshold for throttling where Android Moderate throttling reports now as Adaptive Performance throttling instead of throttling imminent.
    • Fix time reporting to Android performance hint manager to report main thread and render thread timing correctly.

    Installation
    To install the package(s), please add them manually to the package manifest or install them via the Adaptive Performance Provider settings menu or upgrade in the package manager.
    Code (CSharp):
    1. "com.unity.adaptiveperformance": "5.0.1",
    2. "com.unity.adaptiveperformance.google.android": "1.1.1",

    As always we love to hear your feedback using those new Adaptive Performance versions.
     
  37. DFC005

    DFC005

    Joined:
    Dec 21, 2017
    Posts:
    2
    Hi @David-Berger, we are getting the following error when updating to 1.1.1.

    Code (CSharp):
    1. Library\PackageCache\com.unity.adaptiveperformance.google.android@1.1.1\Runtime\Provider\GoogleAndroidAdaptivePerformanceSubsystem.cs(582,69): error CS1061: 'FrameTiming' does not contain a definition for 'cpuMainThreadFrameTime' and no accessible extension method 'cpuMainThreadFrameTime' accepting a first argument of type 'FrameTiming' could be found (are you missing a using directive or an assembly reference?)
    We don't get this on 1.1.0.
     
  38. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    What Unity Version is that?
     
  39. LioMiss1

    LioMiss1

    Joined:
    Nov 25, 2020
    Posts:
    1
    2021.3.16f1
     
  40. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    Thanks for reporting that. It's a bug. Sorry for that. Will fix it in 1.1.2

    For now, to unblock you can replace

    Code (CSharp):
    1.  
    2. var frameTimeInInt = (int)((frameTimings[0].cpuMainThreadFrameTime + frameTimings[0].cpuRenderThreadFrameTime) * 1000000.0);
    3.  
    with

    Code (CSharp):
    1.  
    2. #if UNITY_2022_1_OR_NEWER
    3.                         var frameTimeInInt = (int)((frameTimings[0].cpuMainThreadFrameTime + frameTimings[0].cpuRenderThreadFrameTime) * 1000000.0);
    4. #else
    5.                         var frameTimeInInt = (int)((frameTimings[0].cpuFrameTime) * 1000000.0);
    6. #endif
    7.  
     
  41. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    We release 1.1.2 to fix the problem @LioMiss1 reported. Thanks for bringing that up.
     
  42. Ootherworld

    Ootherworld

    Joined:
    Nov 28, 2022
    Posts:
    2
    Hi,I used an empty scene which occupied 100MB of memory. After adding ADP, it became 150MB. What are the main aspects of memory usage by ADP?
     
  43. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    It would be around 500kb. Not much more, a little more per Scaler, but not more otherwise.

    After your report we tested it again on different Unity Versions, with empty scenes with scenes and content (eg. the samples) on different host environments. We have not found any memory increase more than 1MB when adding AP. Is there any more information or a test sample you can provider?
     
  44. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    We released an update for Adaptive Performance version 5.0.2 and the Android Provider version 1.2.1 today. It comes as verified packages in 2023.3+ but also work with 2021.2+.

    New in Adaptive Performance 5.0.2
    • Fixed asset save decision which causes the editor to save profiles constantly while the Adaptive Performance settings window is open.
    • Meta file which should not be there since the folder is empty.
    New in Google Android 5.0.2
    • Some devices do not report correct thermal headroom numbers. Disabling Adaptive Performance on those devices.
    • (1.2.0) Unity Support Version dropped to 2021

    Installation
    To install the package(s), please add them manually to the package manifest or install them via the Adaptive Performance Provider settings menu or upgrade in the package manager.
    Code (CSharp):
    1. "com.unity.adaptiveperformance": "5.0.2",
    2. "com.unity.adaptiveperformance.google.android": "1.2.1",

    As always we love to hear your feedback using those new Adaptive Performance versions.
     
    OmarVector likes this.
  45. OmarVector

    OmarVector

    Joined:
    Apr 18, 2018
    Posts:
    129
    @David-Berger May I ask , if the adaptive performance on Android/iOS support Webgl runtime as well or not?

    I did try looking for that in the documentation but I couldn't find any
     
  46. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    Adaptive Performance is native only. Are there any specific Webgl APIs you are looking for being supported?
     
  47. OmarVector

    OmarVector

    Joined:
    Apr 18, 2018
    Posts:
    129
    To answer your question: No, there is no specific API, I'm just not sure if the package is useful if we shipping a webgl build just to run on Android/iOS..... would be possible to clarify if the package would have any effect on webgl builds that is runs on Mobile phones?

    Thanks for your patiences:))
     
  48. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    743
    Without specific APIs the answer is no, it won't activate anything on the OS side and won't be activated in the app either.
     
    DeathPro and OmarVector like this.
  49. OmarVector

    OmarVector

    Joined:
    Apr 18, 2018
    Posts:
    129
    Reply, thank you:)
     
  50. nisafitri

    nisafitri

    Joined:
    Dec 24, 2023
    Posts:
    2
    Hello, I really appreciate writing this kind of content. This content is useful for me. keep sharing content like this. Thank You