123456789101112131415161718192021222324252627282930313233343536373839 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using KairoEngine.Utilities;
- using Sirenix.OdinInspector;
- using KairoEngine.Core;
- namespace KairoEngine.Utilities.Statistics
- {
- [HideMonoScript]
- public class StatisticElapsedTime : MonoBehaviour
- {
- public string statisticName = "";
- [ReadOnly] public string elapsedTime;
- [HorizontalGroup()] public bool unscaledDeltaTime = true;
- [HorizontalGroup()] public bool resetOnStart = true;
- void Start()
- {
- if(resetOnStart) Statistics.GetData(statisticName).Reset();
- }
- void Update()
- {
- if(unscaledDeltaTime)
- {
- Statistics.GetData(statisticName).AddTime(Time.unscaledDeltaTime);
- }
- else
- {
- Statistics.GetData(statisticName).AddTime(Time.deltaTime);
- }
- float time = Statistics.GetData(statisticName).GetTime();
- elapsedTime = KairoEngine.Core.Utilities.TimeToString(time);
- }
- }
- }
|