Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Official Update for Frame Timing Manager

Discussion in 'Profiler Previews' started by antonk-unity, Nov 2, 2021.

  1. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    508
    Sorry for this - as a part of Dynamic Resolution feature we only supported on 2021 iOS
    , macOS and tvOS (Metal only), Android (Vulkan only), Windows Standalone (DirectX 12 only), and UWP (DirectX 12 only). We've extended support to almost all platforms it in 2022, but it required changes that could destabilize 2021, so we didn't backport those changes to 2021.

    One option you may be able to use depending on the platform is native graphics plugin API - https://docs.unity3d.com/2021.3/Documentation/Manual/NativePluginInterface.html
    It should be possible to obtain the render device and use it to issue timestamps/timerqueries at a certain point of frame and collect later.
     
    paulatwarp and MartinTilo like this.
  2. paulatwarp

    paulatwarp

    Joined:
    May 17, 2018
    Posts:
    135
    It turns out it does work for my platform in 2021.3 :D, just not in the editor.
     
    MartinTilo likes this.
  3. Xaron

    Xaron

    Joined:
    Nov 15, 2012
    Posts:
    386
    Funny. For me it works in the editor and standalone development builds but NOT in standalone release builds. :/
    Unity 2021.3.22f1
     
  4. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,517
    The improvements mentioned in this thread landed on 2022.1.0a14
     
  5. Xaron

    Xaron

    Joined:
    Nov 15, 2012
    Posts:
    386
    Thank you! Understandable.
     
    MartinTilo likes this.
  6. peterc-neq

    peterc-neq

    Joined:
    Jan 17, 2024
    Posts:
    2
    Hi, I was wondering if you could help.

    I am using Unity 2022.3.14f1.

    I have a script that collects profiling data using ProfileRecorders with the Time Manager Manager enabled over 60 frames. However the data I am collecting seems quite inconsistent and it would be great to get some clarification on what I am seeing.

    The stats I am collecting are :-

    "CPU Total Frame Time"
    "CPU Main Thread Frame Time"
    "CPU Render Thread Frame Time"
    "GPU Frame Time"
    "Main Thread"
    "PlayerLoop"

    The problem I am seeing is that "CPU Total Frame Time", "CPU Main Thread Frame Time", "Main Thread" and "PlayerLoop" stats seem quite inconsistent, for example on one frame "CPU Total Frame Time" is the slower value where as on another "CPU Main Thread Frame Time" is slower and another the "PlayerLoop" stat is slower.

    I would expect that there should be a stat that is consistently the slowest stat, that stat shows the time the whole frame takes on the CPU(including waiting for other threads to sync with the main thread).

    Any information on this would be of great help.
     
  7. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,517
    For others following along, the above has been answered in this thread.
     
    codestage likes this.
  8. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    473
    This ProfilerRecorder returns zeroes in non-Development Build iOS players, but works fine in Development Build iOS players, and in Unity Editor regardless of the Development Build setting. I am intentionally not setting the project setting to enable the FrameTimingManager in all builds, as the only release builds we want it enabled in are internal.
    "CPU Main Thread Frame Time" and "CPU Render Thread Frame Time" ProfilerRecorders do not have this inconsistency. (2022.3.23f1, URP 14.0.10)
    Code (CSharp):
    1. m_gpuRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Internal, "GPU Frame Time");
    2.  
     
  9. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,517
    @chrismarch thanks to you we noticed the examples here and in the documentation have not been updated to reflect the fact that these counters don't belong to the Internal category but to the Rendering one. That was a late change to the code when the examples were already written.

    I'm not sure that'd fix your issue but I didn't get to test that theory. I'm on PTO for the next week and didn't want to leave you hanging for too long though. If you give that a try, please let me know if that worked :)
     
    codestage likes this.