Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How long does it take for a frame to show up on my screen after Update() has finished?

Discussion in 'Editor & General Support' started by momenslythe, Apr 15, 2016.

  1. momenslythe

    momenslythe

    Joined:
    Aug 26, 2015
    Posts:
    5
    As the title, how long does it take for a frame to show up on my screen after Update() has finished?

    From some preliminary hardware testing, it seems like about 4 frames (~66.67ms) but is there a definite answer? How much does it vary per system?

    Also is there a scriptable way to tell the current time since the start of the frame? Time.time just gives me the time at the start of the current frame. I'd like to know how much time has passed between the start of the frame and the code I'm about to execute.

    I'm trying to figure out some solutions for external hardware interactions that require precise timings.

    Thanks!
     
  2. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
  3. momenslythe

    momenslythe

    Joined:
    Aug 26, 2015
    Posts:
    5
    All of those are locked to the beginning of a frame or physics frame. None can tell me the time it takes for something to show up on my screen or the time from the beginning of the frame to when process X completes.
     
  4. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    I was referring to:" Also is there a scriptable way to tell the current time since the start of the frame?"

    Which you can deduce from the values you can get from that Time class.

    Edit:

    To get: "beginning of the frame to when process X completes."

    float timeSinceFrameStarted = Time.realtimeSinceStartup - Time.time;
     
    momenslythe likes this.
  5. momenslythe

    momenslythe

    Joined:
    Aug 26, 2015
    Posts:
    5
    I see, that will work great! Sorry and thanks, I missed that realtimeSinceStartup was not locked to the frame's start.

    Now to figure out when stuff will start to display on the screen...
     
    larku likes this.