initial commit

This commit is contained in:
Jo 2025-01-07 02:06:59 +01:00
parent 6715289efe
commit 788c3389af
37645 changed files with 2526849 additions and 80 deletions

View file

@ -0,0 +1,50 @@
// UltEvents // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
namespace UltEvents.Benchmarks
{
/// <summary>[Editor-Only]
/// A simple performance test that loads and instantiates a prefab to test how long 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/EventBenchmark")]
public sealed class EventBenchmark : MonoBehaviour
{
/************************************************************************************************************************/
[SerializeField]
private string _PrefabPath;
/************************************************************************************************************************/
private void Update()
{
// Wait a bit to avoid mixing this performance test in with the engine startup processes.
if (Time.timeSinceLevelLoad < 1)
return;
// Sleep to make this frame show up easily in the Unity Profiler.
System.Threading.Thread.Sleep(100);
var start = EditorApplication.timeSinceStartup;
// Include the costs of loading and instantiating the prefab as well as the actual event invocation.
var prefab = Resources.Load<GameObject>(_PrefabPath);
Instantiate(prefab);
Debug.Log(EditorApplication.timeSinceStartup - start);
enabled = false;
}
/************************************************************************************************************************/
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 497712a3d29c46645b6633712f5975da
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,38 @@
// UltEvents // Copyright 2021 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

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2ecd8d6ecfcb0d1409a227c2b117a74e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,35 @@
// UltEvents // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
#if UNITY_EDITOR
using UnityEngine;
namespace UltEvents.Benchmarks
{
/// <summary>[Editor-Only]
/// A simple performance test which invokes a <see cref="UltEvent"/>.
/// </summary>
[AddComponentMenu("")]// Don't show in the Add Component menu. You need to drag this script onto a prefab manually.
[HelpURL(UltEventUtils.APIDocumentationURL + "/Behchmarks/UltEventBenchmark")]
public sealed class UltEventBenchmark : EventBenchmarkBase
{
/************************************************************************************************************************/
[SerializeField]
private UltEvent _Event;
/************************************************************************************************************************/
/// <summary>Called by <see cref="Awake"/>.</summary>
protected override void Test()
{
_Event.Invoke();
}
/************************************************************************************************************************/
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: da9e6f3d7b0a35d48bbb43b5b52529e9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,36 @@
// UltEvents // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
#if UNITY_EDITOR
using UnityEngine;
using UnityEngine.Events;
namespace UltEvents.Benchmarks
{
/// <summary>[Editor-Only]
/// A simple performance test which invokes a <see cref="UnityEvent"/>.
/// </summary>
[AddComponentMenu("")]// Don't show in the Add Component menu. You need to drag this script onto a prefab manually.
[HelpURL(UltEventUtils.APIDocumentationURL + "/Behchmarks/UnityEventBenchmark")]
public sealed class UnityEventBenchmark : EventBenchmarkBase
{
/************************************************************************************************************************/
[SerializeField]
private UnityEvent _Event;
/************************************************************************************************************************/
/// <summary>Called by <see cref="Awake"/>.</summary>
protected override void Test()
{
_Event.Invoke();
}
/************************************************************************************************************************/
}
}
#endif

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 84601744a18dc8d48a9e3068c3ec5aa5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: