Skip to content

Commit

Permalink
feat: display FPS every second
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpach committed Oct 14, 2020
1 parent 507d997 commit ae62e35
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@ void Start()
#endif

HeadlessStart();

StartCoroutine(DisplayFramesPerSecons());
}

private IEnumerator DisplayFramesPerSecons()
{
int previousFrameCount = Time.frameCount;

while (true)
{
yield return new WaitForSeconds(1);

int frameCount = Time.frameCount;

int frames = frameCount - previousFrameCount;

Debug.LogFormat("{0} FPS", frames);
previousFrameCount = frameCount;
}
}

void HeadlessStart()
Expand Down

0 comments on commit ae62e35

Please sign in to comment.