From fdab0985629604b634cb6521f50b0bcf9181a483 Mon Sep 17 00:00:00 2001 From: Pasha Bibko <156938226+PashaBibko@users.noreply.github.com> Date: Thu, 29 Jan 2026 15:59:27 +0000 Subject: [PATCH] tmp --- Assets/Pacore/Runtime/ClassAttributeCache.cs | 20 +++++++++++++++++++ Assets/Pacore/Runtime/DelegateFunction.cs | 4 ++++ .../Pacore/Runtime/DelegateFunction.cs.meta | 3 +++ 3 files changed, 27 insertions(+) create mode 100644 Assets/Pacore/Runtime/DelegateFunction.cs create mode 100644 Assets/Pacore/Runtime/DelegateFunction.cs.meta diff --git a/Assets/Pacore/Runtime/ClassAttributeCache.cs b/Assets/Pacore/Runtime/ClassAttributeCache.cs index db8da39..718178b 100644 --- a/Assets/Pacore/Runtime/ClassAttributeCache.cs +++ b/Assets/Pacore/Runtime/ClassAttributeCache.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System; +using System.Diagnostics; using UnityEngine; namespace PashaBibko.Pacore @@ -9,6 +10,15 @@ namespace PashaBibko.Pacore public static class ClassAttributeCache { private static Dictionary> AttributeCache { get; set; } + private static DelegateFunction OnCacheInstantiated = LogCacheInformation; + + private static int AttributeCount; + private static int ClassCount; + private static long TimeTaken; + + private static void LogCacheInformation() + { + } public static ReadOnlyCollection GetAttributesOf() { @@ -20,6 +30,8 @@ namespace PashaBibko.Pacore [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)] private static void ScanAllAssemblies() { + Stopwatch timer = Stopwatch.StartNew(); + /* Fetches all the class types in all loaded assemblies */ Type[] classes = AppDomain.CurrentDomain.GetAssemblies() // Assembly[] .SelectMany(assembly => assembly.GetTypes()) // IEnumerable @@ -52,6 +64,14 @@ namespace PashaBibko.Pacore AttributeCache[type].Add(current); } } + + /* Stores all relevant info for logging */ + TimeTaken = timer.ElapsedMilliseconds; + AttributeCount = AttributeCache.Count; + ClassCount = classes.Length; + + /* Calls the delegate function for any dependencies */ + OnCacheInstantiated.Invoke(); } } } diff --git a/Assets/Pacore/Runtime/DelegateFunction.cs b/Assets/Pacore/Runtime/DelegateFunction.cs new file mode 100644 index 0000000..8487f3b --- /dev/null +++ b/Assets/Pacore/Runtime/DelegateFunction.cs @@ -0,0 +1,4 @@ +namespace PashaBibko.Pacore +{ + public delegate void DelegateFunction(); +} diff --git a/Assets/Pacore/Runtime/DelegateFunction.cs.meta b/Assets/Pacore/Runtime/DelegateFunction.cs.meta new file mode 100644 index 0000000..5576161 --- /dev/null +++ b/Assets/Pacore/Runtime/DelegateFunction.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 627efc92baea4fec9e576642408e796c +timeCreated: 1769701523 \ No newline at end of file