Mirror of Svelto.ECS because we're a fan of it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
900B

  1. #if UNITY_EDITOR
  2. using System;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.SceneManagement;
  6. //This profiler is based on the Entitas Visual Debugging tool
  7. //https://github.com/sschmid/Entitas-CSharp
  8. namespace Svelto.ECS.Profiler
  9. {
  10. public class EngineProfilerBehaviour : MonoBehaviour
  11. {
  12. public Dictionary<Type, EngineInfo>.ValueCollection engines { get { return EngineProfiler.engineInfos.Values; } }
  13. public void ResetDurations()
  14. {
  15. EngineProfiler.ResetDurations();
  16. }
  17. void OnEnable()
  18. {
  19. SceneManager.sceneLoaded += OnLevelFinishedLoading;
  20. }
  21. void OnDisable()
  22. {
  23. SceneManager.sceneLoaded -= OnLevelFinishedLoading;
  24. }
  25. void OnLevelFinishedLoading(Scene arg0, LoadSceneMode arg1)
  26. {
  27. ResetDurations();
  28. }
  29. }
  30. }
  31. #endif