You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/3rd/Plugins/UltEvents/Misc/Benchmarks/EventBenchmarkBase.cs

38 lines
1.3 KiB
C#

2 months ago
// UltEvents // Copyright 2020 Kybernetik //
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
namespace UltEvents.Benchmarks
{
/// <summary>[Editor-Only]
/// A simple performance test which calls <see cref="Test"/> in <see cref="Awake"/> and logs the amount of time it
/// takes.
/// </summary>
[AddComponentMenu("")]// Don't show in the Add Component menu. You need to drag this script onto a prefab manually.
[HelpURL(UltEventUtils.APIDocumentationURL + "/Behchmarks/EventBenchmarkBase")]
public abstract class EventBenchmarkBase : MonoBehaviour
{
/************************************************************************************************************************/
private void Awake()
{
var start = EditorApplication.timeSinceStartup;
Test();
Debug.Log(EditorApplication.timeSinceStartup - start);
}
/************************************************************************************************************************/
/// <summary>Called by <see cref="Awake"/>.</summary>
protected abstract void Test();
/************************************************************************************************************************/
}
}
#endif