Make work with astra
This commit is contained in:
parent
21859bcfb3
commit
c8ee5045e2
1 changed files with 6338 additions and 4613 deletions
38
UnityProject/Assets/ThirdParty/Standard Assets/Utility/FPSCounter.cs
vendored
Normal file
38
UnityProject/Assets/ThirdParty/Standard Assets/Utility/FPSCounter.cs
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UnityStandardAssets.Utility
|
||||
{
|
||||
[RequireComponent(typeof (Text))]
|
||||
public class FPSCounter : MonoBehaviour
|
||||
{
|
||||
const float fpsMeasurePeriod = 0.5f;
|
||||
private int m_FpsAccumulator = 0;
|
||||
private float m_FpsNextPeriod = 0;
|
||||
private int m_CurrentFps;
|
||||
const string display = "{0} FPS";
|
||||
private Text m_Text;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
m_FpsNextPeriod = Time.realtimeSinceStartup + fpsMeasurePeriod;
|
||||
m_Text = GetComponent<Text>();
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// measure average frames per second
|
||||
m_FpsAccumulator++;
|
||||
if (Time.realtimeSinceStartup > m_FpsNextPeriod)
|
||||
{
|
||||
m_CurrentFps = (int) (m_FpsAccumulator/fpsMeasurePeriod);
|
||||
m_FpsAccumulator = 0;
|
||||
m_FpsNextPeriod += fpsMeasurePeriod;
|
||||
m_Text.text = string.Format(display, m_CurrentFps);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue